A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
You have to use .HTMLBody, not .Body, and you have to code in HTML :o(
This is a helpful page: http://www.computerhope.com/learnhtm.htm, as is http://www.computerhope.com/htmcolor.htm
Try:
Dim strMsg As String
strMsg = "<P>Some text here " _
& "<FONT style=""BACKGROUND-COLOR: yellow""><STRONG>" _
& Worksheets("Email").Range("A38").Value _
& "</FONT></STRONG>" _
& " some more text " _
& "<FONT color=""red"" style=""BACKGROUND-COLOR: gray"">" _
& Worksheets("Email").Range("A2").Value _
& "</FONT>" _
& " closing text here.</P>" & Application.UserName
.HTMLBody = strMsg
.Display
or
Dim strMsg As String
strMsg = "<P><FONT style=""BACKGROUND-COLOR: yellow""><STRONG>" _
& Worksheets("Email").Range("A38").Value _
& "</FONT></STRONG>" _
& " " _
& "<FONT color=""red"" style=""BACKGROUND-COLOR: gray"">" _
& Worksheets("Email").Range("A2").Value _
& "</FONT></P>" & Application.UserName
.HTMLBody = strMsg
.Display
Note that when building your string in VBA, any quotation marks to appear within the string need to be doubled-up, like this:
myString="Here is a string containing a quote ""My quote"" which is nice."
would return: Here is a string containing a quote "My quote" which is nice.
Make sense?
Hope that helps.
Cheers
Rich