Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"excel "macros may be disabled" message using an xlam file frustrated Excel Worksheet Functions 2 July 13th 09 08:32 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
how to eliminate E-mail "To" & "CC" boxes at top of Excel Sheet BillFitz Excel Discussion (Misc queries) 10 March 24th 08 11:42 AM
How do I ignore the "Number stored as text" error message permane. reston33 Excel Discussion (Misc queries) 2 March 28th 07 02:59 AM
"word unable to open data source" message when trying to do mail m funeralman Excel Discussion (Misc queries) 1 June 2nd 06 11:04 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"