The following code uses com-handles to try and connect to Word. If it connects to a running instance of Word then hWord has a valid-handle. If hWord = ? then it means it could not connect to a running instance of Word.
DEFINE VARIABLE hWord AS COM-HANDLE NO-UNDO.
CREATE "Word.Application" hWord CONNECT NO-ERROR.
IF NOT VALID-HANDLE(hWord) THEN
MESSAGE "Word not running.".
ELSE
MESSAGE "Word is running.".
RELEASE OBJECT hWord NO-ERROR.
You could then add the following code to run Word and make it visible.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.