September 6, 2019
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
CC: Mike@intel.com
Message Path: E:\messages\Case (# 44347_2) Inquiry.msg
I found attached macro in myonlinetraininghub.com and I need your help to update it.
Thanks;
Marsil
Trusted Members
December 20, 2019
October 5, 2010
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
The following users say thank you to Philip Treacy for this useful post:
PurfleetSeptember 6, 2019
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
October 5, 2010
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
September 6, 2019
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
October 5, 2010
Hi Marsil,
Please see the attached file which is based on some code from https://stackoverflow.com/ques.....om-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
Answers Post
September 6, 2019
Hi Phil,
Thank you for your always support.
I checked the macro and it is ok, as I found the email address.
It just need to fix below point.
Please check attached, you will find in Column A, the Send Display name "Marsil Sarvis" and In Column D, you will find the email address for sender as below
Marsil Sarvis <marsil-sarvis@xxxx.com> and there is no data in E column.
So please can you handle this as below.
Column A, contain the email address for sender.
Column D, contain the email address for TO
Column E, contain the email address for CC.
Thanks is not enough, but really don't know what else say to you.
Thanks,
Marsil
October 5, 2010
No worries Marsil.
To get the email address for the sender change
Range("A1").Offset(i, 0).Value = Email.SenderName
to
Range("A1").Offset(i, 0).Value = Email.SenderEmailAddress
Col D should already contain the TO email address and Col E should be listing any CC email addresses. When I test this at my end this is exactly what it is doing.
If it is not doing the same for you can you please provide a screenshot of the email showing the email(s) where it is not working. Just the email addresses, you don't need to show the email content.
Regards
Phil
1 Guest(s)