保存一个Outlook项目VBA问题

我无法保存outlook项目。 (嗯,我刚刚意识到我正在与Word女士 – 这是否有关系吗?我仍然可以在这里发表?)无论如何,问题是,Word正在创build消息,并发送它就好(附件,主题和一切) ,但它不是正确地将文件保存在指定的位置。 它保存为1 KB,不开放。 下面是错误的代码和图像。 非常感谢您的帮助!

码:

Private Sub CommandButton1_Click() Dim myString As String Dim myString2 As String Set myOlApp = CreateObject("Outlook.Application") Set myItem = myOlApp.CreateItem(olMailItem) ' Doing some texts replacements here. myString = Label9 myString = Replace(myString, "[Name of Person]", TextBoxNoP.Value) myString = Replace(myString, "[Name of Establishment]", TextBoxNoE.Value) myString = Replace(myString, "[Date Received]", TextBoxDR.Value) myString2 = Label10 myString2 = Replace(myString2, "[Name of Establishment]", TextBoxNoE.Value) myString2 = Replace(myString2, "[Date Received]", TextBoxDR.Value) ' Done with texts replacements here. Setting up, saving and sending messages. Set myAttachments = myItem.Attachments myItem.To = TextBoxTo.Value myItem.CC = TextBoxCC.Value myItem.Subject = myString2 myAttachments.Add "\\di-afs.doi-ad.state.nv.us\LifeHealth\Charitable Gift Annuities\Charitable Gift Annuities 2016\Pending Charitable Gift Annunites\" & TextBoxAtt.Value & ".pdf" myItem.Body = myString myItem.SaveAs "\\di-afs.doi-ad.state.nv.us\LifeHealth\Charitable Gift Annuities\Charitable Gift Annuities 2016\E-mails sent by Nanci\" & myString2 & ".msg", olMsg myItem.Send Unload Me End Sub 

链接到错误的屏幕截图

非常感谢您的帮助!

尝试在调用SaveAs之前调用myItem.Save。

我想到了。

我需要从SaveAs行的末尾删除“,olMsg”部分。 不pipe怎么说,多谢拉!