hi there. i cross posted in:
http://www.mrexcel.com/forum/excel-q...s-outlook.html
my desired output for my email draft would be:
Dear Participant
Facebook (Facebook account activated on the first day class)
Username: Unique ID
Thank you.
But it somehow turns out like this:
Dear Participant
Facebook
(Facebook account activated on the first day class)
Username:
Unique ID
Thank you.
My code is as per below. could anyone assist?
Sub CreateMailNewLearners()
Dim objOutlook As Object
Dim objMail As Object
Dim rngTo As Range, rngCC As Range
Dim rngSubject As Range
Dim rngBody As String
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
Set rngTo = Range("H2")
Set rngSubject = Range("A1")
rngBody = "<BODY style=font-size:11pt;font-family:Calibri >Dear Participant" & _
"<BODY style=font-size:14pt;font-family:Calibri;font-weight:Bold >Facebook (Facebook account activated on the first day class)" & _
"<BODY style=font-size:11pt;font-family:Calibri;font-weight:Bold >
Username: " & "<BODY style=font-size:11pt;font-family:Calibri >Unique ID" & _
"<BODY style=font-size:11pt;font-family:Calibri>
Thank you.</BODY>"
With objMail
.to = rngTo.Value
.Subject = rngSubject.Value
.HTMLBody = rngBody & .HTMLBody
.Save
.Close 1
End With
Set objOutlook = Nothing
Set objMail = Nothing
Set rngTo = Nothing
Set rngSubject = Nothing
End Sub
Bookmarks