I have 2 separate applications that use ole automation to pass mail merge documents to MS word.
The relevent code is:
*-* Setup and activate Word
oWord = CREATEOBJECT("Word.Application")
*-* Document file location and file name
oDocument = oWord.Documents.ADD( gcTxtDocFile )
*-* && .dat file location and file name
oWord.ActiveDocument.MailMerge.OpenDataSource( gcTxtDatFile )
The last line throws:
OLE IDispatch exception code 0 from Miocrosoft Word: Cannot activate application.
What I can't figure out is that it only fails in one of the apps. the other one works fine. I copied the form and Word files from 1 app to the other and made a few changes to filenamse and paths.
The files exist. I even tried the 2 files from the working app and still get the error.
I have run out of ideas of what to look for.
Any suggestions are appreciated.