Hey guys amd gals, I am getting an error when trying to send an automated email with an attachement. Without the attachment it works just fine. I've done this before, with only minor changes to the code and it worked just fine, so I am at a loss now.
Dim sAtt1 As String: sAtt1 = "O:\CSO\Repair Management-Service Partner Data\DealerNotification\dealerEmail\unitsPerDealer\202960.xlsx"
Dim sAtt2 As String: sAtt2 = "O:\CSO\Repair Management-Service Partner Data\DealerNotification\dealerEmail\nationalAccountSoldUnits.xlsx"
Dim sAtt3 As String: sAtt3 = "O:\CSO\Repair Management-Service Partner Data\DealerNotification\dealerEmail\warrantyExtensionLetter.pdf"
Dim OutApp As Object
Dim outMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set outMail = OutApp.CreateItem(0)
With outMail
.To = "[email protected]"
.Subject = "Warranty Extension Program Dealer Notification"
.Body = sBody
.Attachments.Add = sAtt3
.Attachments.Add = sAtt2
.Attahcments.Add = sAtt3
.Send
End With
Here is my error:
error.png
When I debug, it highlights the first .Attachements.add
However, if I comment out the first two attachments, and only try the third, it changes the error code to a 438.
TIA for the help!
Bookmarks