agentkramr
Board Regular
- Joined
- Dec 27, 2021
- Messages
- 95
- Platform
- Windows
i have the attached Macro
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
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
any help would be greatly appreciated