The following code works on Excel and Outlook 2010 but not on Excel and Outlook 365. Very simply, I just want to use an HTML Outlook template and add additional text to the beginning of the email based on one cell in my Excel worksheet. I've noticed in "Locals" that the variable objMail under "Body" the whole template in a string is there, but nothing is in "Body" for the same code using Excel 365. In 365 I get run-time error 287 (application-defined or Object-defined error) on the vtemplatebody = objMail.HTMLbody Line. I've been reading all kinds of code surrounding this issue but so much of it is more complicated and I don't understand it yet. Thanks in advance for any and all help!
Sub MyHTMLMail() Dim OutApp As Outlook.Application Set OutApp = CreateObject("Outlook.Application") Dim objMail As Outlook.MailItem Set objMail = OutApp.CreateItemFromTemplate("C:\annyn\LH.oft") vtemplatebody = objMail.HTMLBody strBody = Range("E2").Value With objMail .BodyFormat = olFormatHTML .HTMLBody = strBody & "<br>" & vtemplatebody .Display End With End Sub