Link to home
Start Free TrialLog in
Avatar of spaced45
spaced45Flag for United States of America

asked on

Export Outlook email content to Access database using script

I get some gaming statistics via email after each game/session and in Outlook I’ve got a rule set up that places the email in it’s own folder. The email looks exactly the same every time in the sense of structure. What I would like to do is store the stats in an Access database.
To check the structure I selected the text and did a simple copy paste into excel and it retained a nice tabular format. Unfortunately if you were to just select all and pasted it into excel it didn’t work so hot since the email has embedded pics it uses as a background.
I would like to see if I can run a script that will extract the contents and place it into Access for me like it did when I pasted it into Excel. I for now I am not looking for it to be perfect I just would like to see it in Access.  Currently I am running Office 2010.
Thank you,
Avatar of edster9999
Flag of Ireland image

You could write a VBA script that would read the mails and export.
Avatar of spaced45


No. Most of what I saw talked about how to extract info like subject and sender. I need something that will grab info out of the body.
Avatar of David Lee
Hi, spaced45.

I might be able to help.  Can you share the body of one of the emails?
I sure can. Let me prepare a screenshot for you.
I dont know if this matters but if I were wanting to copy and past the text from the email into something else, I would have to be careful in positioning my cursor in front of the words "We hope you...." and ending after the number "3" at the bottom right corner. Starting anywhere else would select the image in the background. I can certainly tell that the text is in a tabular format because when I am making a selection I can see that its selecting in order.
Could you export one of these messages to a .msg file and upload it to this question so I can use it to test the process?  
I think I can do that.
Ok, I have the extraction part done.  I need the details of the table(s) and fields the data goes into in order to do the code for inserting the data into the database.
Wow! I appreciate this. I am going to upload an excel sheet with the numbers in the example I uploaded. Its going to be pretty simple table. Should take me about 5min. Thanks again.
"What I would like to do is store the stats in an Access database. "

Ummm, I thought you wanted the data in Access.  I can put it into a spreadsheet, but that's going to be a lot more difficult, especially the way this spreadsheet is laid out.
Confused? I was just showing using excel to show you what I was looking to do. Cant send and Access file over the web....
You can load an Access file here.  If you already have something, then I'd rather use it than create my own Access database and find that I've structured it differently from yours.
I have not created it yet. Would it just be easier to export to excel. If so I could just import the excel sheet and it to a table using some code I have used before.
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial