ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Email Formatting (https://www.excelbanter.com/excel-programming/407411-email-formatting.html)

bodhisatvaofboogie

Email Formatting
 
I was wanting to add some bold highlighting to the body of an e-mail that I'm
automatically generating with this bit of code. Now I know that there is no
way to do formatting within the strbody, as it is just a string of text.
However is there some way to do that if I were to put the text into the .Body
= Spot??? Specifically I want the CURmonth to be bolded within the body,
what might that look like? Thanks!!!!

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

CURmonth = CStr(MonthName(Month(Now) - 1))
strbody = "Text " & CURmonth & "Text"
On Error Resume Next
With OutMail
.To = e-mail address
.CC = ""
.BCC = ""
.Subject = "TEXT"
.Body = strbody
.Attachments.Add ("FILENAME")
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing


ND Pard

Email Formatting
 
Try .HTMLBody instead of .Body

Then use HTML coding to bold the desired text.
Example: The following word <b is </b in bold.

Good Luck.

"bodhisatvaofboogie" wrote:

I was wanting to add some bold highlighting to the body of an e-mail that I'm
automatically generating with this bit of code. Now I know that there is no
way to do formatting within the strbody, as it is just a string of text.
However is there some way to do that if I were to put the text into the .Body
= Spot??? Specifically I want the CURmonth to be bolded within the body,
what might that look like? Thanks!!!!

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

CURmonth = CStr(MonthName(Month(Now) - 1))
strbody = "Text " & CURmonth & "Text"
On Error Resume Next
With OutMail
.To = e-mail address
.CC = ""
.BCC = ""
.Subject = "TEXT"
.Body = strbody
.Attachments.Add ("FILENAME")
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com