Creating "Plain Text" mail message in Outlook from Excel VBA

S

Shane

Hi,
I'm trying to streamline the sending of e-mails by Microsoft Outlook
using VBA from Excel.

My problem is that the code below (taken from )
creates an "Rich Text Format" email, whereas I need the message in
"Plain Text".

Can anyone help?

Thanks

Shane


Sub Mail()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Application.ScreenUpdating = False
Set olApp = New Outlook.Application


Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = "(e-mail address removed)"
.Body = "Hello"
.Display
End With
Set olMail = Nothing

Set olApp = Nothing
Application.ScreenUpdating = True
End Sub
 
J

Jake Marx

Hi Shane,

Try this line before the .Display line:

.BodyFormat = olFormatPlain

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
J

Jim Rech

I believe your macro will create a message in whatever the default message
format is, so the easiest solution may be just to change that.

I'm not an Outlook expert but I believe Outlook 2002 and 2003 supports the
BodyFormat property which would override the Outlook default. I don't think
Outlook 2000 supports this but I'm not sure.

Msg.BodyFormat = 1 'olFormatPlain
 
S

Shane

Jake,

Thank you for the reply.

When I try to include you line I get an
Runtime error 438 "Object doesn't support this property or method"!

I'm running Microsoft Excel 2000 and Outlook 2000 sp3.

Any ideas?

btw, the default message format in Outlook is "plain text".

regards

Shane
 
J

Jake Marx

Hi Shane,

Sorry for the confusion. See Jim Rech's reply, which indicates (correctly)
that Outlook 2000 doesn't have the BodyFormat property in its object model.

From looking here:

http://www.slipstick.com/dev/code/zaphtml.htm

Under the Notes section, you'll see that Outlook 2000 creates messages in
Rich Text format when you set the body via the Body property (no matter what
the default is set to). You may want to try an Outlook group to see what
you can do about it.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 

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