ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating "Plain Text" mail message in Outlook from Excel VBA (https://www.excelbanter.com/excel-programming/285662-creating-plain-text-mail-message-outlook-excel-vba.html)

Shane

Creating "Plain Text" mail message in Outlook from Excel VBA
 
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 www.rondebruin.nl)
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 = "
.Body = "Hello"
.Display
End With
Set olMail = Nothing

Set olApp = Nothing
Application.ScreenUpdating = True
End Sub

Rocky McKinley

Creating "Plain Text" mail message in Outlook from Excel VBA
 
You may have to set outlook up to send plain text Emails as default.

--
Regards,
Rocky McKinley


"Shane" wrote in message
...
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 www.rondebruin.nl)
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 = "
.Body = "Hello"
.Display
End With
Set olMail = Nothing

Set olApp = Nothing
Application.ScreenUpdating = True
End Sub




Jake Marx[_3_]

Creating "Plain Text" mail message in Outlook from Excel VBA
 
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]


Shane wrote:
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 www.rondebruin.nl)
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 = "
.Body = "Hello"
.Display
End With
Set olMail = Nothing

Set olApp = Nothing
Application.ScreenUpdating = True
End Sub


Jim Rech

Creating "Plain Text" mail message in Outlook from Excel VBA
 
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

--
Jim Rech
Excel MVP



Shane

Creating "Plain Text" mail message in Outlook from Excel VBA
 
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


On Wed, 17 Dec 2003 09:24:15 -0700, "Jake Marx"
wrote:

Hi Shane,

Try this line before the .Display line:

.BodyFormat = olFormatPlain



Jake Marx[_3_]

Creating "Plain Text" mail message in Outlook from Excel VBA
 
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 he

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]


Shane wrote:
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


On Wed, 17 Dec 2003 09:24:15 -0700, "Jake Marx"
wrote:

Hi Shane,

Try this line before the .Display line:

.BodyFormat = olFormatPlain




All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com