Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"excel "macros may be disabled" message using an xlam file | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
how to eliminate E-mail "To" & "CC" boxes at top of Excel Sheet | Excel Discussion (Misc queries) | |||
How do I ignore the "Number stored as text" error message permane. | Excel Discussion (Misc queries) | |||
"word unable to open data source" message when trying to do mail m | Excel Discussion (Misc queries) |