How to set a long HTMLBody

  • Thread starter Thread starter mml
  • Start date Start date
M

mml

Hi,

Thank's for any help.
Here's the point : I have to set an HTML background when opening an ItemMail
by code.

Her's my code :
<CODE>
Set MMLMsg = Application.CreateItem(olMailItem)
MMLMsg.BodyFormat = olFormatHTML
MMLMsg.HTMLBody= ?????
</CODE>

How to write several lines of HTML code, including CSS style inside my VBA
code ?
Only one line is accepted...
Is it possible to set the content in a variable ?
How to do that ?
Other idea ?....
 
No, HTMLBody takes a string, which can have embedded carriage returns

MMLMsg.HTMLBody = _
"<html>" & vbCrLf & _
"<body>" & vbCrLf & _
"<b>Bold</b> text" & vbCrLf & _
"</body>" & vbCrLf & _
"</html>"

Or, if you have HTML stored in a file, read that file into a string andd
assign it to the HTMLBody property

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top