Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error automating Word: OLE IDispatch exception code 0...
Message
From
18/07/2000 11:15:33
Karl Zercoe
Titanium Software, Inc.
Houston, Texas, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Error automating Word: OLE IDispatch exception code 0...
Miscellaneous
Thread ID:
00393836
Message ID:
00393836
Views:
90
I am using VFP 6.0 SP3 to automate Word 97 SR2. I periodically get the error message “OLE IDispatch exception code 0 from MSWord. Object has been deleted.”

The code is running through the FormFields collection with code like
* oAD is a pointer to the ActiveDocument
for each oField in oAD.FormFields
cFieldName = oField.Name
endfor

What makes this odd is that I actually do this twice. I open a specific Word document, scan through the collection of bookmarks/fields and stuff them with values from a table. I then activate Word and let the user fill in any missing field values. When they return to VFP I run through the collection again saving their entries.

The first time works fine, the second generates the error message.

I can also reference the Word field objects by the syntax oAD.FormFields[nIndex] and when I do that I find that out of the 53 fields in the collections I can reference the fields at location 1, and 25-53. The fields between 2 and 24 all generate the error message.

Any suggestions would be appreciated.
Next
Reply
Map
View

Click here to load this message in the networking platform