'VBA Outlook - Get email addresses from attached .msg files

I would like to have some code that helps me to get the email address of the sender of an attached .msg file.

I have an email with around 10 emails attached. I need to copy the sender address from them into the clipboard or an excel sheet.



Solution 1:[1]

You would need to

  1. save the attachment as an msg file,
  2. open it using Namespace.OpenSharedItem
  3. once you open it as MailItem, you can read the MailItem.Sender properties.

You can also use Redemption (I am its author) - it allows to directly open the message attachments as RDOMail objects using RDOAttachment.EmbeddedMsg.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1