Macro - Open new message, populate from and subject fields, and message text

A

AndreaP

Hello all,

I am trying to create a macro for Outlook 2003 that will open a ne
message, populate the From Field, populate the Subject field (thes
never change), and then populate the body of the email (which als
never changes). I am very new to this. My goal is to steamline th
process down to "click a button, get a populated email".

I have the first part:

Dim olkMsg As Outlook.MailItem
Set olkMsg = Application.CreateItem(olMailItem)
olkMsg.SentOnBehalfOfName = "Email address"
olkMsg.Subject = "My Subject"
olkMsg.Display

And the message:

Selection.TypeText Text:="Good morning,"
Selection.TypeParagraph
Selection.TypeParagraph

.... and so on

When I run the macro, the first part executes fine. I run into problem
with the body of the email, because I keep getting the following error:

Run-time error '424': Object Required

What object should come between the first part of my macro and th
text?

Thank you
 
M

Michael Bauer [MVP - Outlook]

The Selection object refers to the Word library, Outlook doesn't know that.
You can use the Word library only in Outlook 2007, or if you have set to use
Word as email editor. In both cases you can access the email as a Word
Document object via the olkMsg.GetInspector.WordEditor property.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Fri, 14 Aug 2009 15:56:22 +0100 schrieb AndreaP:
 

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