
WScript.GetObject doesn't get running Word App
My environment:
Windows NT 4.0 SP6a, WSH 5.6
My problem:
I have a running Word (document), i.e. one instance of winword.exe. Now
the following VBS Script within WSH should allow me to do some event
handling:
SUB WordEventDocumentChange()
CALL MsgBox ("Event fired")
END SUB
SET MyApp = WScript.GetObject("","Word.Application","WordEvent")
DO WHILE TRUE
WScript.Sleep (1000)
LOOP
When I execute the Script the running Word (object) isn't selected but
an addtional instance of winword.exe is started (TaskMgr). Also Clicking
in the original running word window doesn't fire the MsgBox. So it seems
that the WScript.GetObject Method can't reuse the running application
but always starts a new instance.
(If I WScript.CreateObject a new instance with an Event Prefix, the
event fires.)
Any hints?
Thansk, Gnther