none
Extract outlook message body text with VBA from Excel RRS feed

  • Question

  • Hi all,

    I have a number of Outlook .msg files saved to a shared network folder (ie outside of Outlook). I am trying to write some VBA in Excel that extracts the message body text from each in turn (as a string)...and then does some other stuff with the contents of the string.

    I've done a similar thing with word documents but I'm struggling to 'get at' the text in the .msg files.

    So far I have the code below. I like to think I'm on the right track at least, but I'm stuck at the line where I'm trying to set up a reference to the msg file. Any advice will be appreciated...

        Dim MyOutlook As Outlook.Application
        Dim MyMail As Outlook.MailItem
        
        Set MyOutlook = New Outlook.Application
        
        
        Set MyMail = '? stuck here!
        
        Dim FileContents As String
        
        FileContents = MyMail.Body

    Regards

    • Moved by Youen Zen Monday, January 30, 2012 7:47 AM To provide a better support (From:Visual Basic General)
    Saturday, January 28, 2012 11:15 AM

Answers

All replies