Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trigger a Word Session
Message
 
To
05/11/2002 12:12:00
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00718757
Message ID:
00719008
Views:
20
I am just guessing, but it seems you want to clear your oWord refernce when a 1426 error occurs(?)

A commom way to clear the reference when no errors occur:
oWord.Quit
release oWord
But for your situation, where you need to release a oWord reference when 1426 happens, you might try something like this (try a test with your "oWord" reference declared public):
procedure MyErrorTrap(merror, mess, mess1, mprog, mlineno)
ON ERROR
* error messagebox or capture dialog here
if merror=1426
   on Error oWord=.NULL.
   oWord=getobject(,'Word.Application')
   if isnull(oWord)
      * Nothing can be done, Windows does not have a reference
   else
      * A reference exists
      oWord.Quit
      release oWord
   endif && IsNull(oWord)
endif &&merror=1426
on error do myErrorTrap with merror, mess, mess1, mprog, mlineno
endproc
I haven't tested this and am just suggesting one approach you might try; if, indeed, we are on the same page regarding this issue.

Please follow up!
Terry

>Hi terry,
>
>this code sample is very good to solve the 1246 error problem, and I will use it. Unfortunately not solve my problem, I need to trigger when the time of processes of a command OLE, it is very long. Because I could be known if the session OLE with Word stopped, but not closed. I really need to know how to do it. If you can help me, I thank at once.
>
>
>Regards,
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform