excel vba - Outlook 2016 VBA MailItem.GetInspector.WordEditor error -


i wrote excel macro mail bunch of people spreadsheet. works fine on old work laptop running office 2013, not in office 2016.

i looked @ changes vba office 2013 2016 , didn't see changes inspector or word editor message objects?

once gets .getinspector.wordeditor throws:

run-time error '287':
application-defined or object defined error

here relevant part of macro:

sub sendemail()     dim actsheet worksheet     set actsheet = activesheet      'directories of attachment , email template     dim diremail string, dirattach string      ' directory of email template word document     diremail = _         "path_to_word_doc_email_body"      ' directories of attachments     dirattach = _         "path_to_attachment"      ' email subject line     dim subjemail string     subjemail = "email subject"      dim wordapp word.application     dim docemail word.document      ' opens email template , copies     set wordapp = new word.application     set docemail = wordapp.documents.open(diremail, readonly:=true)     docemail.content.copy      dim outapp outlook.application     set outapp = new outlook.application     dim outmail mailitem     dim outedit word.document      ' names/emails send     dim docname string, sendemail string, ccemail string, sitename string     dim corname string      dim row integer     row = 2 20          sendname = actsheet.cells(row, 1)         sendemail = actsheet.cells(row, 2)         ccemail = actsheet.cells(row, 3)         sitename = actsheet.cells(row, 4)          set outmail = outapp.createitem(olmailitem)         outmail             .sendusingaccount = outapp.session.accounts.item(1)             .to = sendemail             .cc = ccemail             .subject = subjemail & " (site: " & sitename & ")"              set outedit = .getinspector.wordeditor             outedit.content.paste              outedit.range(0).insertbefore ("dear " & sendname & "," & vbnewline)              .attachments.add dirattach              .display             '.send          end         debug.print row          set outmail = nothing         set outedit = nothing     next row      docemail.close false     wordapp.quit end sub 

edit: thing's i've tried based on suggestions:

  • checked outlook settings - default html text
  • moved .display on .getinspector.wordeditor

edit 2: added full macro

ensure word default email editor. inspector.wordeditor dox:

the wordeditor property valid if iswordmail method returns true , editortype property oleditorword . returned worddocument object provides access of word object model...

further, ensure outlook configured send rich text or html emails, not plain text.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -