我正在尝试使用Excel VBA发送带有附件的电子邮件。
如果我不包括附件代码行,则我的代码正在发送电子邮件。
当我写那行来发送附件时,它显示错误。
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "saurabh.ad.sharma@accenture.com"
.Subject = "Subject"
.ReadReceiptRequested = False
.HTMLBody = "resport"
.Attachment = "C:\Users\saurabh.ad.sharma\Desktop\rrr.xlsx"
End With
MyItem.Send
Run Code Online (Sandbox Code Playgroud)