Macro not picking up 4th cell entry

agentkramr

Board Regular
Joined
Dec 27, 2021
Messages
91
Platform
  1. Windows
i have the attached Macro
VBA Code:
Sub sales_Email()

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
  With OutMail
  .to = "test@test.com"
  .CC = ""
  .BCC = ""
  .Subject = "Internet Sales Reports  " & Format(Date, "m/d/yy")
  .Display
  .HTMLBody = strbody & .HTMLBody
  .attachments.Add ThisWorkbook.Sheets("List of Files").Cells(1, 1).Text
  .attachments.Add ThisWorkbook.Sheets("List of Files").Cells(2, 1).Text
  .attachments.Add ThisWorkbook.Sheets("List of Files").Cells(3, 1).Text
  .attachments.Add ThisWorkbook.Sheets("List of Files").Cells(4, 1).Text
  .Send
 
  End With
  On Error GoTo 0
 
  Set OutMail = Nothing
  Set OutApp = Nothing

End Sub
it should look to to the cells in my spreadsheet for what to attach to an email, it doesnt do the fourth cell for some reason. it skips over it everytime IT DOES attach the first second and third cell though

any help would be greatly appreciated
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

StephenCrump

MrExcel MVP
Joined
Sep 18, 2013
Messages
5,053
Office Version
  1. 365
Platform
  1. Windows
Step1: Comment out your On Error Resume Next statement.

Are you getting an error? Does that error help you understand what's wrong with the 4th cell?
 

agentkramr

Board Regular
Joined
Dec 27, 2021
Messages
91
Platform
  1. Windows
Step1: Comment out your On Error Resume Next statement.

Are you getting an error? Does that error help you understand what's wrong with the 4th cell?
weird thing ...... if i comment that out it attaches all the files like it should
 

Forum statistics

Threads
1,181,057
Messages
5,927,875
Members
436,574
Latest member
Bosniain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top