0

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?

KuKeC
  • 4,392
  • 5
  • 31
  • 60

3 Answers3

0

When doing COM, both applications (OrenEdge and Word) should be same "bitness". To be safe, both products should be 32 bit - I'm not 100% sure if 64 bit Word supports Automation interfaces.

The alternative on 11.6 might be the Interop API's (.NET): https://msdn.microsoft.com/de-de/library/microsoft.office.interop.word(v=office.11).aspx

Mike Fechner
  • 6,627
  • 15
  • 17
0

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

KuKeC
  • 4,392
  • 5
  • 31
  • 60
0

Problem for me was although it shows only ms office 2016 is installed and only one version of it. When I looked under start and went to outlook it showed the normal icon for outlook and the another one that said outlook 2016.

So I set up the user profile on the normal outlook, made sure that is open and not the outlook 2016 one and now the mail merge works for me.

Hope this helps someone out.