我想创建一个将两个文件附加到邮件的VBA脚本。这段代码让我附上一个文件:
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
只有当我将.Attachments.Add(var2)更改为.Attachments.Add(var2& var3)时,它才会起作用。有人告诉我如何附上第二个附件吗?
答案 0 :(得分:2)
.Attachments.Add var2
.Attachments.Add var3