rsilvergun has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I'm trying to write a script to back up Microsoft Outlook files. One of the things I wanted to do was close Outlook, make sure it's closed, and then back up the files. I thought I could use Win32::OLE like so to close Outlook:
$x1 = Win32::OLE->new('Outlook.Application', 'Quit'); $x1->Quit();
but it doesn't work. Outlook will eventually quit, but only when my whole script terminates. Is there another method I need to call the Destructor and close the program, or is it because I'm not properly de-referencing my variable? I'd don't want to send a kill signal to the process if I can help it, since killing Outlook has a bad habit of corrupting the PST files.

Replies are listed 'Best First'.
Re: Simple Win32::OLE question (I hope)
by GrandFather (Saint) on Jun 11, 2007 at 03:50 UTC

    Does adding:

    $x1 = undef;

    after the Quit help?


    DWIM is Perl's answer to Gödel
      Sweet! Thank you, that worked like a charm. I knew there was something simple I was forgetting. Jeez it's been a while since I've coded com if I'm forgetting to dereference my variables :).