Attaching more than one file to an email with VBA

T

Tom Joseph

Can someone please advise on the proper syntax for attaching more than one
file to a message?

The error occurs at:

.Attachments.Add FilenameStr2


Thanks,



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

'On Error Resume Next
With OutMail
.To = emails
.CC = ""
.BCC = ""
.Subject = "Hourly TAT Performance: " & _
Worksheets("Labels").Cells(4, i).Value & " - " & _
Sheets("Main").Range("AB8").Value
.Body = "Reports attached"
' .BodyFormat = olFormatPlain 'testing for text format
.Attachments.Add FilenameStr
.Attachments.Add FilenameStr2
.Attachments.Add FilenameStr3
.Attachments.Add FilenameStr4
.Send 'or use .Display
End With
 
T

Tom Joseph

Thanks Ron. I had the files renaming as the same file, so the attachement
instruction failed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top