Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word automation - Failure & OLE error without a 'pause'
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00831858
Message ID:
00831888
Views:
24
I would try to disable antivirus priogram temporary and see if it helps.

>Hi all,
>
>Question re Automating Microsoft Word: I have a Word automation routine that worked flawlessly for several months. After a hard drive crash and a reinstallation of everything (WinXP-Pro, Office 2002, VFP7, my app, my data, etc) the routine continually crashed after the createobject() step (same app, same code, same data, etc). After much testing, I found a solution, which is to insert a 3 second pause after the createobject() line. Here's the test code I used:
>
>oWord = createobject("Word.Application")
>wait window "Not sure why this is needed!" timeout 3 && WHY???
>oDoc = oword.Documents.Add()
>oRange = odoc.Range()
>oRange.Text = "Hello there"
>oDoc.SaveAs("wordtest.doc")
>oDoc.Close
>
>I discovered the need for the 3 second pause after finding that the code (without the pause) worked fine when entered line-by-line from the command window, but not from a prg.
>
>I'm sure that there's some setting somewhere (WinXP? Office? Word? VFP?) that needs to be tweaked, but I can't for the life of me figure it out. For now, the 3 second pause appears to be doing the job, but I'd really like to get it back to it's original (no pause) state. When the app does crash (without the pause), it gives an OLE error code 0x80010105 "server threw an exception" followed by various Word errors and Word often then crashes. I tried making Word visible after createobject(), but without the pause it still crashed.
>
>Any help would be greatly appreciated!
>
>- Larry
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform