Hello,
First post here, but I've been searching the archives and don't see a solution to a problem I'm having.
We have a VFP 9 application that filters a table for all records that have a "selected" field set. It then scans through that filtered table, takes a bookmark name from another field and searches a Word for that bookmark. If it finds that bookmark in the word document, it selects the text, and appends it to a different word document.
We just switched from Office 2010 to Office 2016 and now this program fails. Here is the portion of code that is failing:
At this point, the program dies with an OLE error saying "the object invoked has disconnected".
While watching the program run, it appears that the line "oWdDestDoc = oWord.Documents.Add()" is not actually creating a new word document to allow the program to paste into it (at least one doesn't show up on the task bar as it previously did).
Is there a different way we have to do this in Office 2016?
Thanks to anyone who can help
First post here, but I've been searching the archives and don't see a solution to a problem I'm having.
We have a VFP 9 application that filters a table for all records that have a "selected" field set. It then scans through that filtered table, takes a bookmark name from another field and searches a Word for that bookmark. If it finds that bookmark in the word document, it selects the text, and appends it to a different word document.
We just switched from Office 2010 to Office 2016 and now this program fails. Here is the portion of code that is failing:
Code:
SELECT program_options
REINDEX
fi = "DocumentParts.docx"
COUNT TO NumSelected FOR selected = .T.
oWord = CREATEOBJECT("Word.Application")
oWord.Visible = .T.
oWdDestDoc = oWord.Documents.Add()
oWdSourceDoc = oWord.Documents.Open(fi)
SCAN
IF selected AND LEN(ALLTRIM(WdBookMark)) > 0
mWdBookMark = ALLTRIM(wdBookmark)
oWdSourceDoc.activate
IF oWord.ActiveDocument.Bookmarks.Exists(mWdBookMark)
*** Copy Body ********************
oWdSourceDoc.Bookmarks(mWdBookMark).select
oWord.Selection.Copy
oWdDestDoc.activate
At this point, the program dies with an OLE error saying "the object invoked has disconnected".
While watching the program run, it appears that the line "oWdDestDoc = oWord.Documents.Add()" is not actually creating a new word document to allow the program to paste into it (at least one doesn't show up on the task bar as it previously did).
Is there a different way we have to do this in Office 2016?
Thanks to anyone who can help