in reply to Re: Win32::OLE problem with Destructing
in thread Win32::OLE problem with Destructing

Why should it have to be active before it can be saved, if I'm telling it which object to use?

I think it's a bug, because if I have Word open it doesn't object to that! Even though this document never shows up in the Word interactive application. So perhaps Word is getting an internal error because at some point it assumes that there is some Active document and dereferencing it or something?

—John

  • Comment on Re: Re: Win32::OLE problem with Destructing

Replies are listed 'Best First'.
Re: Win32::OLE problem with Destructing
by cacharbe (Curate) on Jul 23, 2001 at 19:16 UTC
    Was that the solution, then?

    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;

    if the document already has a name.

    C-.