Macro not picking up 4th cell entry

agentkramr

Board Regular
Joined
Dec 27, 2021
Messages
95
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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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?
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,638
Members
449,093
Latest member
Ahmad123098

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
Back
Top