question

DURANDDECORBIACOlivier-4078 avatar image
0 Votes"
DURANDDECORBIACOlivier-4078 asked

Outlook 365 VBA - MailItem.GetInspector.WordEditor - Run-time error '287': Application-defined or object defined error

Hello,

I recently changed Office 2013 to Miscrosoft 365, and there is a peace a code that used to work perfectly fine that does not anymore.
This code, executed from an Excel workbook, creates an email from a template (.oft). I have several modifications to do on the created mail item, so I use this :

 Sub CreateEmail(ByRef olApp As Outlook.Application, ByVal TemplatePath As String)
    
   Dim olMailItem As Outlook.MailItem
    
   Set olMailItem = olApp.CreateItemFromTemplate(TemplatePath)
   With olMailItem.GetInspector.WordEditor
     'Code to modify the email
   End With
    
 End Sub
    
 ' The line "With olMailItem.GetInspector.WordEditor" returns Run-time error '287':
 ' Application-defined or object defined error

This code worked perfectly on Office 2013. Any suggestion please ?
Thanks in advance for any help I will get.

office-vba-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers