Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 7 crashing Word Automation
Message
From
15/02/2002 13:09:08
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
VFP 7 crashing Word Automation
Miscellaneous
Thread ID:
00620775
Message ID:
00620775
Views:
49
Hi all,

some of our applications are automating MS Word to create letters and fill in app data like addresses etc. All of a sudden, the automation won't work anymore. Word will crash on the attempt to open an existing doc and OLE Error 80010105 is returned to VFP. I have reduced the code to the following code snippet, which will reproduce the error with any word doc:
LOCAL loWord


loWord = CREATEOBJECT("Word.Application")
=MESSAGEBOX("blah",64,"blah")                && if this line was commented out, the next line will crash
loWord.Documents.Open(FULLPATH("Test.doc"))  && OLE Error 80010105 without MessagBox
loWord.Visible = .T.
loWord         = .NULL.
RELEASE loWord
The environment is: Win2k SP 2, Word XP, VFP 7 SP 1.

As I found out, it will work as expected if there is any other window of the VFP app coming to foreground between the instantiation of Word.Application and the attempt to open the document. WAIT WINDOW, FOR Loops or the like won't have a positive effect. At least there must be a MessageBox to let it work, like in the snippet above. Throw that line out and you'll see it crash, WINWORD.EXE is floating around in memory, the doc will be destroyed eventually - so don't test it with the only copy of your thesis!

Without the MessageBox the code works fine under VFP 6 SP 4 in the same environment with the same doc.

Anybody able to reproduce that behaviour?

If so, again: is that a bug or a feature?

TIA Robert
I've acquired quite a taste for a well-made mistake... [Fiona Apple]
Next
Reply
Map
View

Click here to load this message in the networking platform