Copy Body of Message to Excel

G

Guest

Hi,

First my apologies: I'm rather new at Outlook programming.

Could someone provide me with some instruction as to how I would copy the
body of an email message and paste it into the first empty row of excel via
an outlook macro?

Thanks for the help!
 
M

Michael Bauer

Hi,

it works without using the clipboard, (OL VBA) sample for one selected
MailItem in the Inbox:

Dim xlApp as Excel.Application
Dim oWs as Excel.Worksheet
Set xlApp=New Excel.Application
Set oWs=xlApp.Workbooks.Add.Worksheets(1)
oWs.Cells(1,1).Value=Application.ActiveExplorer.Selection(1).Body

For opening an existing Workbook please see the ObjectBrowser,
Workbooks.Open method and press F1 for more help and code samples.
 
G

Guest

Hi Michael, thanks for the help.

I'm getting the compile error "user defined-type not defined" on the row

Dim xlApp as Excel.Application

How can I correct this?
 
M

Michael Bauer

Hi Kabaka,

please go to Extras/References an select Excel (Microsoft Excel...).
 

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