Export Body to Excel

J

Jim

Will someone please advise how to export the body of an email to Excel

The emails are system generated and therefore in a standard format.
Once in Excel I will be able to parse the text using vba without any
problems but I am stumped with vba in Outlook.

Regards and many thanks

Jim Burton
 
K

Ken Slovak - [MVP - Outlook]

How do you decide which emails to export information from? Are they
selected, opened, or what?

Let's say it's based on an item being opened. To get the text information,
assuming you only want the plain text information, you access the Body of
that item:

Dim oMail As Outlook.MailItem
Set oMail = Application.ActiveInspector.CurrentItem

That will only work with email items and from within the Outlook VBA
project.

Then:

Dim strBody As String
strBody = oMail.Body

From there you have a string variable holding the item text, at that point
you open your Excel worksheet or work with an open worksheet and acess the
cell you want the text put into, using Excel code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top