in reply to Can not connect existing Outlook

I actually prefer something like this:

use strict; use warnings; use Win32::OLE; my $oa; eval {$oa = Win32::OLE->GetActiveObject('Outlook.Application')}; die "Outlook not installed" if $@; unless (defined $oa) { print "Outlook is not running. Attempting to start it.\n"; $oa = Win32::OLE->new('Outlook.Application', sub {$_[0]->Quit;}) or die "Oops, cannot start Outlook"; } # do something with $oa here

Replies are listed 'Best First'.
Re: Re: Can not connect existing Outlook
by banduwgs (Beadle) on Aug 05, 2003 at 15:14 UTC

    It's really funny the thing happen with this code.
    I exicuted this snipplet while open Outlook. It gave me following output

    Outlook is not running. Attempting to start it.

    and terminated existing Outlook application as expected.

    I would like to know exact versions you are using. For me, it is
    Windows: 98 SE 4.10.2222 A
    Outlook: 2000 SR-1 (9.0.0.3821)

    Do you have any suggession?

    Thanks a lot for keep on your attention - SB

      Version info:
      Windows 98 4.10.1998
      Outlook 2000 SP-3 (9.0.0.6627)
      ActiveState Perl v5.6.1 built for MSWin32-x86-multi-thread, Binary build 633
      Win32::OLE version 0.1403

        It seems like the culprit is Outlook as Mr. Muskrat has a more recent version of Outlook 2000 and so do I. Maybe you need to install an update Sumith - we can that together if you wish...