objMsg.CreateHTMLBody

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
Michael Baasch
Newbie
Posts: 4
Joined: Mon Jun 22, 2009 8:39 pm

objMsg.CreateHTMLBody

Post by Michael Baasch » Thu Dec 29, 2016 11:45 am

Hi
if i change line objMsg.Body = strBody
to objMsg.CreateHTMLBody "file//e:/temp/mit/upload/16122016_0834.htm"
i get this error
>>microsoft VBScript runtime error: 438
object doesn't support this property or method objMsg. CreateHTMLBody
:?


VB Script

VBStart
Function CreateEmail(strTo, strSubj, strBody, html, strbodyhtml)
'Create OL App object
Set objOLApp = CreateObject("Outlook.Application")
If objOLApp is nothing then
MsgBox "Could not create OL App. Shutting Down"
Exit Function
End If
'Create a new mail item
Set objMsg = objOLApp.CreateItem(0)
If objMsg is nothing then
MsgBox "Could not create Mail Item. Shutting Down"
Exit Function
End If

'Set basic message parameters
objMsg.To = strTo
objMsg.Subject = strSubj
'objMsg.Body = strBody
objMsg.CreateHTMLBody "file//e:/temp/mit/upload/16122016_0834.htm"

''Send the message
objMsg.Send
''Free up the space
Set objOLApp = Nothing
Set objMsg = Nothing
CreateEmail = "Success"
End Function
VBEnd

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: objMsg.CreateHTMLBody

Post by Marcus Tettmar » Wed Jan 04, 2017 10:08 am

I don't think that method is supported for Outlook items - at least not any more. It's a part of the IMessage interface, part of CDO. I know there are old articles on this forum that show what you've done but it looks like this may have changed in Outlook.

From what I have found it used to work in old versions of Outlook but no longer does (seemingly for "security" reasons!).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts