Hi,
Could you please help me.
I have a lot of outlook messages in folder in my PC and I want to extract these "Subject, Received Date/Time, To, CC, Message Path"
Example:
Subject: Test
Received Date/Time: Sun 5/31/2020 9:24 AM
To: bill@xcompany.com
CC: Mike@intel.com
Message Path: E:messagesCase (# 44347_2) Inquiry.msg
I found attached macro in myonlinetraininghub.com and I need your help to update it.
Thanks;
Marsil
Hello
Are the emails saved as seperate .msg in a folder on your harddrive or are they still in outlook?
Hi Purfleet,
Thank you for fast response.
Yes I have all messages in Outlook.
Note: I have two account in my outlook and I want to get data for specific folder, Please check attached image.
Grateful for your support..
Thanks;
Marsil
Hi Marsil.
See attached file. From your image it looks like you want emails that are not in your default email account. In which case you need to change this line in the VBA
Set Folder = OutlookNS.Folders("NAME OF EMAIL ACCOUNT").Folders("Inbox")
Insert the NAME of your account, NOT the email address. So if your account is in the name Marsil Sarvis then insert that.
I don't understand what you are referring to when you talk about the Message Path. Each email will be stored within the mailbox not separately on the hard drive as .msg files - which is what Purfleet was asking about too.
Regards
Phil
Hi Phil,
I want to thank you for your continued support.
I saved it path as my target is save all these messages in Path and send to another person to read email body and signatures then extract valuable information.
Could you please help me as I face attached issues when I try to run the macro please.
Grateful for your support..
Thanks;
Marsil
Hi Marsil,
You need to set a reference to the Microsoft Outlook 16.0 Object Library in the VBA editor. Sorry I thought you'd already done this as your first post gave me the impression you'd run the code already.
Open the Excel file, go into the VBA editor and then from the menu click Tools -> References and check the box beside the library
Regards
Phil
Hi Phil,
Please see attached image and I think there is something is wrong from my side.
Thanks
Marsil
Hi Phil,
I can't see "Outlook 16.0 Object Library" in References window, please check attached image.
It is contain " missing microsoft outlook 16.0 object library"
Please can you let me know how I can add "Outlook 16.0 Object Library" in References window?
Thanks;
Marsil
Hi Guys,
Try the attached file. I've rewritten it to use late binding so you don't need to set a reference to the Outlook library.
Cheers
Phil
Hi Phil
It works perfectly That's a huge help - thanks!
I check macro result and I have below notes, Please take a look.
----Macro give error when it face “meeting invitation email”, please check attached image.
If u can help me to ignore any “meeting invitation email” to let the macro complete to extract all messages.
-----In To & CC columns contain the display name not emails address.
If you can update this to extract the email address not display name.
Ex: the current result is “Marsil Sarvis” , please I need marsil-sarvis@xxxx.com
Thanks again. Couldn't have done it without you.
Thanks;
Marsil
Hi Marsil,
Try this.
regards
Phil
Hi Phil,
Please check attached macro result.
Thanks,
Marsil
Hi Marsil,
That is a Microsoft Exchange user. Are you connected to Exchange?
Phil
Hi Phil,
I think yes, I run the macro from my PC and I don't open the outlook online.
Please let me know what's the issue.
Thanks;
Marsil
Hi Marsil,
Please see the attached file which is based on some code from https://stackoverflow.com/questions/7941191/extract-email-address-from-outlook
I can't really test this for you as I am not connected to your Exchange server and the code relies on this.
Regards
Phil