>>>You should do it differently:
>>>1. Link oWord to form property, i.e.
>>>Thisform.oWordapp=Createobject("word.application")
>>>2. Check VarType(Thisform.oWordapp) and IsNull(Thisform.oWordapp) in Form.QueryUnload to prevent closing.
>>
>>Hi Ed,
>>
>>I found that checking for vartype = 'O' is not enough. After I added a check for visible = .t. it worked.
>
>Did you try IsNull?
No, but vartype will return X for NULL.
If it's not broken, fix it until it is.
My Blog