VBA not formatting email correctly

ccordner

Active Member
Joined
Apr 28, 2010
Messages
355
I'm sending an email using VBA with the following code:

VBA Code:
Sub CreateEmail()

'Find the last row of the mailing list
lngLastRow = Sheets("Interface").Cells(Rows.Count, 4).End(xlUp).Row

For lngRowCount = 25 To lngLastRow
     'Create and declare an Outlook Application Object
Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olMailItem)
    With objmail
        .To = Sheets("Interface").Cells(lngRowCount, 4)
'        .ReplyRecipients = "*****@gmail.com"
        .Subject = "Test Subject"
        .BodyFormat = olFormatHTML
        .Body = "Testing the  <h2>HTML</h2> test"
        .NoAging = True
'        .Attachments.Add Folder
        .send
    End With
'Clear the objects after use
Set objmail = Nothing
Set objol = Nothing
Next

End Sub

However, instead of interpreting the body as HTML, it just displays the HTML tags - both in the 'Sent Items' folder of Outlook and on my mobile phone browser. Have I missed something?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top