【发布时间】:2018-08-23 00:40:39
【问题描述】:
我正在尝试使用 OLE 自动化在 Outlook 中发送电子邮件。目前,我正在使用 VBS 进行测试。当它工作时,我会切换到另一种支持 OLE/COM 的语言。
我的代码的问题是,我收到错误 800a0005 "Invalid procedure call" with argument 'BodyFormat'。
根据documentation of Microsoft,BodyFormat 自 Outlook 2003 以来就存在。我正在使用 Outlook 2010 进行测试。
我的代码:
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
With newMail
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY>Type the message text here. </BODY></HTML>"
.Display
End With
背景:目前部分客户收到TNEF格式的邮件,无法打开邮件附件winmail.dat。所以我试图强制 Outlook 使用 HTML 而不是 RichText。
我能做什么?
【问题讨论】: