下面的代码添加了一个附件,但它会创建一个新的电子邮件。
Sub BA7()
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Set myItem = Application.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments
myAttachments.Add "J:\BUILDING\Email attachments\BA7word.docx", _
olByValue, 1, "BA7"
End Sub
有没有办法在当前打开的电子邮件中添加附件?
答案 0 :(得分:1)
替换
行Set myItem = Application.CreateItem(olMailItem)
与
Set myItem = Application.ActiveInspector.CurrentItem
如果在检查器中打开该项目,或者如果在资源管理器消息列表中选择了该项目,则使用以下项目:
Set myItem = Application.ActiveExplorer.Selection(1)