Hi
I am creating a new email in Outlook 2007 using an VS2008 add-in, and save it to local disc.
It creates the new Mailitem, saves it as MSG, and I can open it from local disc (by double clicking on file c:\temp.msg) while outlook is still open.
When I close outlook, and then try to open the file from disc (by double clicking on the file c:\temp.msg), it does show the email message, BUT with an error messagebox saying : "Object reference not set to an instance of an object."
Anyone have an idea what could be wrong?
Code:Imports Microsoft.Office.Interop.Outlook Public Class save_message Private Sub btn_send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_send.Click Dim oApp As Outlook.Application Dim oMsg As Outlook.MailItem oApp = New Outlook.Application() oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem) With oMsg .To = "[email protected]" .Subject = "this is the subject" .Body = "this is the body" End With oMsg.SaveAs("c:\temp.msg", OlSaveAsType.olMSG) End Sub




Reply With Quote
