【发布时间】:2022-10-04 22:16:21
【问题描述】:
我正在尝试在 Excel 中使用 VBA 将这些消息分隔为称呼、正文和签名,这将生成一封自动 Outlook 电子邮件。但是我不能使用换行符将它们分开。愿意帮忙吗?
Dim MyOutlook As Object
Set MyOutlook = CreateObject("Outlook.Application")
Dim MyMail As Object
Set MyMail = MyOutlook.CreateItem(olMailItem)
MyMail.To = "sampleemail@google.com"
MyMail.CC = "sampleemail@google.com"enter code here
MyMail.Subject = "Sample Subject"
MyMail.Body = "Hello Team," & _
"Please see attached for this month's summary" & _
"Thanks!" & _
"Sample Signature"
Attached_File = "C:\Users\public\Documents\sample_reports.xls"
MyMail.Attachments.Add Attached_File
MyMail.Send
End Sub
【问题讨论】:
-
尝试使用
<br>。 -
如果 <br> 不起作用,请尝试将
vbNewLine附加到.Body中的行尾