Question
Thread display: Collapse - |
All Answers
Share your knowledge
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
save Outlook 2007 email as a msg file from VB.NET 2008
Here?s my code and the error occurs on the save as statement. Thanks in advance for any insight!
Dim i As Int16
Dim temp As Object
Dim mailitem As Microsoft.Office.Interop.Outlook.MailItem
Dim subject As String
Dim strSaveName As String
For i = 1 To OL.ActiveExplorer().Selection.Count
temp = OL.ActiveExplorer().Selection(i)
Next
If (TypeOf (temp) Is Microsoft.Office.Interop.Outlook.MailItem) Then
mailitem = temp
subject = mailitem.Subject.Replace(":", "")
subject = mailitem.Subject.Replace(".", "")
strSaveName = subject & Format(Now, " ddmmyyyyhhnnss") & ".msg"
mailitem.SaveAs(strDir & strSaveName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)