user181796
user181796

Reputation: 313

Attach two files in a mail

I would like to create a VBA script which attaches two files to a mail. This code lets me attach one file:

Sub openWord()

Dim OutApp As Object
Dim OutMail As Object


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

var2 = "D:\Werkdocumenten\CBIP\CBIP_MANUAL_PART1.pdf"
var3 = "D:\Werkdocumenten\CBIP\CBIP_MANUAL_PART2.pdf"

With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "CBIP Manual"
.Body = ""

.Attachments.Add (var2)
.Display
End With

End Sub

Only if I change .Attachments.Add (var2) to .Attachments.Add (var2 & var3) it does not work. Anybody clues on how I can attach the second attachment?

Upvotes: 0

Views: 3170

Answers (1)

.Attachments.Add var2
.Attachments.Add var3

Upvotes: 2

Related Questions