Reputation: 399
I am trying to send mail that is formated as HTML but I get an error showing that olFormatHtml
is not declared. How do I declare it?
Upvotes: 0
Views: 5148
Reputation: 230
I'm using VBA in Excel 2007 to attach a workbook to an email and format the body of that email. I just tried this suggestion and got a run-time error 438: Object doesn't support this property or method.
Instead I set .bodyformat = 2
to display email text as html, and it worked. For example....
Set Outlook = CreateObject("Outlook.Application")
Set MailItem1 = Outlook.CreateItem(0)
With MailItem1
.BodyFormat = 2
'sample formatting change....
.htmlbody = "<font color = 'red'>" & "SAMPLE TEXT" & "</font><br/>"
.display
End With
Set MailItem1 = Nothing
Set Outlook = Nothing
Upvotes: 1