![]() |
Creating formatted Outlook Msg from VBA
Hi,
Is there a way to create e-mail messages in Outlook via Excel VBA with formatted (i.e. bold, colored) text. I am currently passing in the string "MailBody" to Outlook using the following code. This code inserts an unformatted text string? Dim OklApp As New Outlook.Application Dim OutLk As Outlook.MailItem Set OutLk = OklApp.CreateItem(olMailItem) OutLk.Body = MailBody Is there any way I can insert formatted text? Thanks, Bill W. |
Creating formatted Outlook Msg from VBA
Hi Bill
See macro examples on my site http://www.rondebruin.nl/sendmail.htm My Add-in (3.0) is doing this also -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "BillW" wrote in message ... Hi, Is there a way to create e-mail messages in Outlook via Excel VBA with formatted (i.e. bold, colored) text. I am currently passing in the string "MailBody" to Outlook using the following code. This code inserts an unformatted text string? Dim OklApp As New Outlook.Application Dim OutLk As Outlook.MailItem Set OutLk = OklApp.CreateItem(olMailItem) OutLk.Body = MailBody Is there any way I can insert formatted text? Thanks, Bill W. |
Creating formatted Outlook Msg from VBA
Bill,
If you use the htmlbody property you can insert normal html formatting codes. You need a reference in the project to Outlook. eg. Sub TestEmail() Dim olApp As Outlook.Application Dim olMail As MailItem Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) With olMail .To = " .Subject = "test format" .HTMLBody = "<BHello</B" & chr(34) & "Goodbye" ..Send End With Set olMail = Nothing Set olApp = Nothing End Sub Robin Hammond www.enhanceddatasystems.com "BillW" wrote in message ... Hi, Is there a way to create e-mail messages in Outlook via Excel VBA with formatted (i.e. bold, colored) text. I am currently passing in the string "MailBody" to Outlook using the following code. This code inserts an unformatted text string? Dim OklApp As New Outlook.Application Dim OutLk As Outlook.MailItem Set OutLk = OklApp.CreateItem(olMailItem) OutLk.Body = MailBody Is there any way I can insert formatted text? Thanks, Bill W. |
All times are GMT +1. The time now is 05:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com