2

I would like to read MSG file stored on the filesystem and do the following:

  • Read the body text of the msg file.
  • Open and save the attachments in the MSG file.

Is it possible using the msoutl.olb#Microsoft Outlook 10.0 Object Library?

I would like to avoid using Outlook Redemption v. 4.7 based on question MSG Read Stackoverflow question

Thank you.

Community
  • 1
  • 1
Koekiebox
  • 5,793
  • 14
  • 53
  • 88

1 Answers1

4

I believe you can. Try adding a reference to the Outlook 10 object library and then try this code:

Dim OL As Outlook.Application
Dim Msg As Outlook.MailItem
Set OL = New Outlook.Application
Set Msg = OL.CreateItemFromTemplate("c:\msg.msg")
' now use msg to get at the email parts
MsgBox Msg.Subject
Set OL = Nothing
Set Msg = Nothing

I can't vouch for any of the methods or properties of your Outlook.MailItem object (msg) but give it a shot and see.

C-Pound Guru
  • 15,967
  • 6
  • 46
  • 67