Be careful to release the Word Application object when operations have finished, and to also include the required error trapping to ensure that this object is safely released should an error occur whilst interfacing with the word document.
Also, you will need to use the Quit method of the Application object to close the Word Application before releasing the object, otherwise the winword.exe process will remain active with no possible way to access the application without terminating the process manually using the Task Manager.
In short, it is good programming practice to clean up after yourself
thats funny i was just going to ask this.
i notice in an excel function it says this for error handling
would this be the same but with my variables?
(defun *error* (msg)
(and msg
(/= msg "Function Canceled")
(princ (strcat "\nError: " msg))
)
(and wBook (vlax-invoke-method wBook 'Close :vlax-False))
(and xlApp (vlax-invoke-method xlApp 'Quit))
(and reg (vlax-release-object reg))
(mapcar (function (lambda (obj) (and obj (vlax-release-object obj))))
(list rng wBook xlApp)
)
(gc)
)
also the doc file opens and closes after running the code
i tried
(vla-put-visible doc :vlax-false)
but that doesnt work, whats the equivalent of this?
or how do stop the doc from popping up and closing?
where should i be looking for the vlax functions?