Ken,
oWord = Create("Word.Application")
could be substitued with :
oWord = getobject("","Word.Application") && Doesn't give error if first activation
checking isnull(oWord) doesn't help. If you make it visible (didn't try with nonvisible) then you could use winapi to check if it's alive. API calls I use are getforegroundwindow (when focus is in word) and iswindow (a do while loop). For an example check mailmerge class code in files\classes. It was written for nonVFP6 users and w95&97 compatible.
Cetin
>Erik,
>
>Thanks for reply - but in regard to #2 ... try ...
>
>oWord = Create("Word.Application")
>oWord.visible = .T.
>oWord.Activate
>? !IsNull(oWord) && returns .T. as expected
>
>Now - go to Word and close it
>
>? !IsNull(oWord) && still returns .T. - but errors any time you try to reference a property ie "oWord.name" and word is obviously, not "up".
>
>Am I missing something?
>Thanks,
>Ken
>
>
>
>>>1) Is there a way for my VFP word application object to respond to Word events? In particular a "Save", closing a document, and quitting Word? Would the new VFP COM object thing with its BindEvents() help?
>>>
>>
>>Boy are you in luck. The Word.Application object exposes exactly 2 events tat you can bind to a VFP object using the VFPCOM dll. ChangeDocument and Quit. Sounds like the 2 you need.
>>
>>
>>>2) Short of the above - I've noticed that when I create a word app object via loWord = Create("Word.Application"), and the user subsequently quits word, my object is still "an object" but trying to reference it gives an error. Is there any way short of some kludgy error trapping here to determine whether my "word object" is still up and running?
>>>
>>
>>is
>>
>>IF !ISNULL(oWord) kludgy?