0

Hi All,

I'm trying to save an incoming email as a .txt document but I'm having some trouble with the VBA.

My procedure is as follows:

Sub ConvertToPlainAndSaveAs(Mymail As MailItem)
    Dim strID As String
    Dim objMail As Outlook.MailItem

    strID = Mymail.EntryID
    Set objMail = Application.Session.GetItemFromID(strID)
    objMail.BodyFormat = olFormatPlain

    objMail.SaveAs "C:\Users\Me\Documents\path\to\Test.txt", olTXT

    Set objMail = Nothing
End Sub

It isn't saving the email though.

Where am I going wrong?

Thanks in advance.

1
Contributor
1
Reply
34
Views
4 Years
Discussion Span
Last Post by Tinnin
0

Turns out it wasn't the procedure that was the problem but the security settings on macros. Don't know why that happened as it worked fine on Friday and I haven't changed a thing. Apparently that's how microsoft rolls. F@*k You, Microsoft!!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.