Reputation: 65
this a part of my code to send an e-mail by outlook in vba. However, I am want to send with the first sentence in bold. Ex: where I write the text in first body (how I named the cell of each paragraph), I can choose where I want the text be bold, but these format do not remain when the vba create the e-mail
Any idea?
EX: My name is Vinicius. I am from Brazil and like Soccer
pretit = Sheets(CurrSh).Range("pretit").Value
midtit = Sheets(CurrSh).Range("midtit").Value
prebod = Sheets(CurrSh).Range("prebod").Value
bod = Sheets(CurrSh).Range("bod").Value
postbod = Sheets(CurrSh).Range("postbod").Value
body2 = Sheets(CurrSh).Range("body2").Value
body3 = Sheets(CurrSh).Range("body3").Value
body4 = Sheets(CurrSh).Range("body4").Value
report = Sheets(CurrSh).Range("report").Value
If Sheets(CurrSh).Range("body4").Value <> vbEmpty Then
'Set ObjApp = CreateObject("Outlook.Application")
While (Sheets(CurrSh).Range("emailad_ini").Offset(n, 0).Value <> "")
emailad = Sheets(CurrSh).Range("emailad_ini").Offset(n, 0).Value
firstname = Sheets(CurrSh).Range("firstname_ini").Offset(n, 0).Value
Set objMail(n) = ObjApp.CreateItem(0)
objMail(n).display
objMail(n).To = emailad
objMail(n).Subject = pretit & " " & firstname & midtit
objMail(n).HtmlBody = "<HTML><BODY><FONT FACE='Arial'><FONT SIZE='2'>" & prebod & " " & firstname & "," & "<br>" & "<br>" & bod & "<br>" & "<br>" & body2 & "<br>" & "<br>" & body3 & "<br>" & "<br>" & body4 & "<br>" & "<br>" & postbod & objMail(n).HtmlBody & "</FONT></FONT></BODY></HTML>"
objMail(n).Attachments.Add (report)
Upvotes: 0
Views: 708
Reputation: 11735
Assuming you are using .HTMLBody
you would just enclose everything you want bold in an HTML bold tag like this:
Not Bold <b>This is bold</b> This is no longer bold.
Upvotes: 1