【发布时间】:2021-06-22 04:07:52
【问题描述】:
我正在尝试将 msg 格式的电子邮件列表保存为 htm 格式,以便 Xceptor 工具可以将电子邮件读取为 pdf。 (没有vba,目前我在Outlook中手动打开邮件并一一保存为htm。)
我在下面找到了脚本,但我得到了
“运行时错误 287:应用程序定义的或对象定义的错误”。
Sub SaveMSG_as_HTML()
Dim olMsg As MailItem
Dim strPath As String
Dim strMsg As String
Dim strHTML As String
strPath = "\\Hbap.adroot.hsbc\hk\Finance\224017\AMH_A2R_2\WRK\AAC\PL\To GFC\Movement Table\MvtXceptor\Configuration\Table18.1\"
strMsg = "RE CRR Inquiry as atJan-00-00 - --.msg"
strHTML = Left(strMsg, InStrRev(strMsg, Chr(46))) & "html"
Set olMsg = Session.OpenSharedItem(strPath & strMsg)
olMsg.SaveAs Path:=strPath & strHTML, Type:=olHTML
olMsg.Close olDiscard
lbl_Exit:
Set olMsg = Nothing
Exit Sub
End Sub
【问题讨论】: