Hi Everyone,

I need some help with Win32:OLE issue.

The same script works fine (scheduled task and when run manually) on local 
machine (Win XP) but does work on a different our server (Win 2000) through 
scheduled task (It does work fine when I run it manually from cmd prompt).

When I look at the log file, I get the following error message. I tried to 
search the net and found several other having similar issues but no resolution.

Unable to open wordWin32::OLE(0.1701) error 0x80070005: "Access is denied"

Here is snippet of the code.

sub doFaxPrint(@)
{
        my @cFiles = @_;
        my $wd = Win32::OLE::Const->Load("Microsoft Word");
        eval
        {
                if ( ! ($word = Win32::OLE->new('Word.Application', 'Quit')) )
                {
                        my $msg = "Unable to open word" . Win32::OLE->LastError;
                        Log($msg, 1);
                        return;
                }

                $word->{Visible} = 0;                                           
# Make Word run in the background
                $orgprinter = $word->ActivePrinter;                     # 
Backup the current default printer setting
                $word->{ActivePrinter} = $vars{PRINTERNAME};            # Set 
the default printer to use fax driver
        };
# On exception, close word
        if ( $@ )
        {
                my $msg = "ALERT!!! OLE Error";
                Log($msg, 1);
                Log($@);
                my $msg = "Attempting to close word";
                Log($msg, 1);
                $word->{ActivePrinter} = $orgprinter;
                $word -> Quit({
                                SaveChanges => $$wd{'DoNotSaveChanges'},
                });
                return;
        }

        foreach my $cFile (@cFiles)
        {
                ### Some code removed
        }
}


I appreciate any help on this regard.

thanks,

Rajesh

_________________________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to