Chuck,
  Thanks for all the help. I found the problem. This one is rather
embarrassing, but interesting so I thought I'd let the group in on it.

  I was racking my brain thinking what the hell could enforce
permissions out side the standard Win2K user stuff. Then I remembered.
A while back I installed Network Associates VirusScan Console software
in order to be able to connect from the outside into my client site. I
shut it off and reran the test. Worked like a charm.

Thanks,
Daniel

-----Original Message-----
From: Charbeneau, Chuck [mailto:CCharbeneau@;lear.com]
Sent: Thursday, October 31, 2002 4:35 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Excel, OLE, and Activestae PERL 5.6.1 rel 633 on Windows
2K.


> From: Daniel Needles [mailto:daniel.needles@;Callisma.com]
> Subject: RE: Excel, OLE, and Activestae PERL 5.6.1 rel 633 on
> Windows 2K.

>    $Excel->{DisplayAlerts}=0;

> Win32::OLE(0.1502) error 0x80070005: "Access is denied"
>     in PROPERTYPUT "DisplayAlerts" at test2.pl line 17


I have a feeling that if you loose this line, the next time you try to
set a
property, you are going to get the same error.

All this does is tell Excel not to throw any pop-up dialogs, and if it
needs
input, take the default (which is usually the safest choice).  You can
try
and remove this line (especially if you leave the Add line the way it
is).

The only other things that I can think of is using Variant true and
false
instead of 1 and 0, and/or setting Visible to true.  I run each code
snippet
on my machine before I send it, so I know it works, so I'm truly
puzzled as
to why yours isn't working.

Somehow, I think it's a permissions issue. Does the user that's
creating the
file have access to run things as admin or system?  If login as an
admin,
what happens?

Chuck.

-----Original Message-----
Chuck,
  I made the switch with the same error. I also recreated the Excel
file using the same user by going into Excel, save as, and quit. Then
from a cmd prompt I called the script file and got the same error.

The new code reads:

C:\Documents and Settings\dln1\My Documents\White Papers\AANC>type
test2.pl
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';

$Win32::OLE::Warn = 3; # Die on Errors.

my $excelfile = 'C:\tmp\Book1.xls';

# VERIFY EXISTENCE
print "LISTING $excelfile\n";
print `dir $excelfile`;

my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
        || Win32::OLE->new('Excel.Application', 'Quit')
            || die Win32::OLE->LastError();

   $Excel->{DisplayAlerts}=0;

#my $Book = $Excel->Workbooks->Open($excelfile) or die
my $Book = $Excel->Workbooks->Add() or die Win32::OLE->LastError();

Win32::OLE->LastError();

print Win32::OLE->LastError();

The output I got reads:

C:\Documents and Settings\dln1\My Documents\White Papers\AANC>perl
test2.pl
LISTING C:\tmp\Book1.xls
 Volume in drive C is LOCAL DISK
 Volume Serial Number is 9C3D-51DA

 Directory of C:\tmp

10/30/2002  10:17a              13,824 Book1.xls
               1 File(s)         13,824 bytes
               0 Dir(s)   8,263,262,208 bytes free
Win32::OLE(0.1502) error 0x80070005: "Access is denied"
    in PROPERTYPUT "DisplayAlerts" at test2.pl line 17

Thanks,
Daniel

-----Original Message-----
From: Charbeneau, Chuck [mailto:CCharbeneau@;lear.com]
Sent: Wednesday, October 30, 2002 12:48 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Excel, OLE, and Activestae PERL 5.6.1 rel 633 on Windows
2K.


> From: Daniel Needles [mailto:daniel.needles@;Callisma.com]
> Subject: RE: Excel, OLE, and Activestae PERL 5.6.1 rel 633 on
> Windows 2K.
>   Thanks for the response. Sorry about that. I sent the message out
> before checking monks again.

Can you change the Open to just ->Add(); ?

This way we can start to check to see if it's a File issue, or maybe
you
have issues with running as system or a named user.

<CODE>
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';

$Win32::OLE::Warn = 3; # Die on Errors.

my $excelfile = 'book1.xls';

my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
            || Win32::OLE->new('Excel.Application', 'Quit')
          || die Win32::OLE->LastError();

   $Excel->{DisplayAlerts}=0;

my $Book = $Excel->Workbooks->Add() or die Win32::OLE->LastError();

printf("The Last error was - %s",Win32::OLE->LastError());
</CODE>
Let's see if it's a file issue or an Excel issue.

Chuck.

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to