Extract data from Outlook messages saved in a C drive folder

ZeeRSA

New Member
Joined
Dec 24, 2013
Messages
23
[FONT=&quot]Hi

Please can someone assist me, [/FONT]
All the answers to this problem pulls the emails directly from outlook, however, I have a folder where an administrator has saved each individual email as a file, I need to extract the data within each of those emails into an excel list which I can then create a data set from to report on.

Please assist any feedback would be helpful tx

please note each email received is saved this way from outlook
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Tell me if the code needs to search the files for several layers of MSG attachments until the real message is found.

Code:
[FONT=Courier New][COLOR=#000000] 
' Excel module
Sub XL_OL()
Dim objOL As Outlook.Application, Msg As MailItem, inpath$, fl, r As Range
Set r = [t1]                                                ' where to paste
Set objOL = CreateObject("Outlook.Application")
inpath = "C:\temp"                                          ' the folder
fl = LCase(Dir(inpath & "\*.msg"))
Do While fl <> ""
    Set r = r.Offset(1)
    Set Msg = objOL.Session.OpenSharedItem(inpath & "\" & fl)
    r = Msg.Body                                            ' copy to cell
    fl = Dir
Loop
Set objOL = Nothing
Set Msg = Nothing
End Sub<strike></strike>
[/COLOR][/FONT]
<strike></strike>
 
Last edited:
Upvote 0
THANK YOU SOOOOO MUCH!!!! YOU ARE A TOTAL ROCKSTAR!

I just wanted to check if it is opening all the emails in the emails? Just to be sure we are not missing any?

Thanks again!! I reallllyyy appreciate the help
 
Upvote 0
You are welcome! :cool:

The code currently does not dig into multiple attachment levels on each message, tell me if you will need that.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top