Hi All,
I have a microsoft word document, and I have got class to handle the manipulation within those documents (I call it "Word").
My code goes this way:
-------------------------------
sub form load
set W = New Word ' W is the Word object
if usingW = true then
'open document in here
'manipulate it
'let the user evaluate it, user can close it anytime they want
end if
end sub
sub form unload
W.Quit ' There is a Quit sub in Word class, which basically erase the winword.exe
end sub
-------------------------------
If I am not using W at all, the winword.exe process can be closed properly when the form unloaded.
the problem exists when the user using the W:
First, if the user still open the word document (opened by the program), the user is forced to close it when the form unloaded.
How can I avoid this? I want to give the user flexibility to close the document whenever they want, even after the form unloaded. I want the program to know that those word documents are still opened, so it doesn't need to call W.Quit
Second, if the user has closed the word document (opened by the program), the program will produce run time error "the remote server machine does not exist or is unavailable"
How can I avoid this? I want the program to know that those word documents have been closed, so it doesn't need to call W.Quit
thanks