in reply to Re: Re: Win32::OLE problem with Destructing
in thread Win32::OLE problem with Destructing
A document doesn't close itself, the application does it.
You are telling the word application implicitly that you want the object that it is working on to be the 'Active' document. It doesn't have to be active for many (most) functions/methods/objects to be referenced, but Close is an exception. It's true with all of the office applications. The Application Engine needs to activate implicitly the open object that needs to be acted on, etc.
You can also name the document specifically through the application object:
$Word->$Documents($Docname)->SaveAs($filename); $Word->$Documents($Docname)->Close; undef $Doc;
C-.
|
|---|