Search code examples
progress-4glopenedgemailmergeoffice-2016

MailMerge not working on Office 2016


I have one program which uses mailmerge in Word and it works perfectly in office 2007 and tested in 2010. But in office 2016 it throws an error

enter image description here

Code is below

ASSIGN lv_cDocument = fiFile.                 /* chosen from program select */
ASSIGN lv_cDataFile = "C:\a\data.dat".
ASSIGN lv_cMailMergeFile = "C:\a\dataOutput.doc".

MailMerge(lv_cDocument,                      /* Main Document */
          lv_cDataFile,                      /* File that holds all the data */
          lv_cMailMergeFile,                 /* File to hold new mail merge document */
          NO).   

DEFINE VARIABLE oWord AS COM-HANDLE NO-UNDO.

CREATE "Word.Application" oWord.
oWord:Documents:Open("C:\a\dataOutput.doc").
oWord:Visible = True.

RELEASE OBJECT oWord.

Any thoughts what is "new" in new office so i can modify my program that it works on all version of MS-Offices?


Solution

  • The problem was in Word options.

    Steps to resolve the auto launch errors:

    • Open MS Word.
    • Click on File > Options.
    • In the General section under Start up options, uncheck the "Open e-mail attachments and other uneditable files in reading view" box.
    • Close Word and try to export and auto launch your document again. It may take a couple of tried for Word to realize the setting has been changed.

    Source