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 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.

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



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



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
auto creating an idex sheet when adding formatted sheets Narnimar Excel Discussion (Misc queries) 15 January 8th 08 06:29 PM
Creating an Outlook Task Item John Google Excel Discussion (Misc queries) 3 November 6th 07 07:58 PM
How can i get formatted data from outlook to excel? [email protected] Excel Worksheet Functions 2 January 11th 07 06:11 AM
Creating spreadsheet of Outlook emails [email protected] Excel Discussion (Misc queries) 3 January 9th 06 04:33 PM
Creating properly formatted text file from vbscript using excel data msnews.microsoft.com[_7_] Excel Programming 2 December 18th 03 09:33 PM


All times are GMT +1. The time now is 12:13 PM.

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

About Us

"It's about Microsoft Excel"