On Wed, 30 Oct 2002, Daniel Needles wrote: > Hello, > > The following program: > > use strict; > use warnings; > use Win32::OLE; > my $xlfile ='c:\tmp\Book1.xls'; > my $xl_app = Win32::OLE->new("Excel.Application"); > $xl_app->{'Visible'} = 0; > my $workbook = $xl_app->Workbooks->Open($xlfile); > my $worksheet = $workbook->Worksheets(1); > my $cellA1 = $worksheet->Range("A1")->{'Value'}; > my $cellB1 = $worksheet->Range("B1")->{'Value'}; > print "Cell A1 = $cellA1"; > $worksheet->Range("A1")->{'value'} = "01aBcD2"; > $cellA1 = $worksheet->Range("A1")->{'Value'}; > print "\nCell A1 = $cellA1"; > $cellA1 = uc $cellA1; > print "\nCell A1 = $cellA1"; > $xl_app->ActiveWorkbook->Close(0); > $xl_app->Quit(); > > Results in the error > > C:\Documents and Settings\dln1\AANC>perl test.pl > > Win32::OLE(0.1502) error 0x80070005: "Access is denied" in > PROPERTYPUT "Visible" at test.pl line 6 > Win32::OLE(0.1502) error 0x80070005: "Access is denied" in > METHOD/PROPERTYGET "" at test.pl line 7 > Can't call method "Open" on an undefined value at test.pl line 7. > > How can I diagnose this problem? >
By looking at your source code and recognizing that you don't have any error checking. For a start I would insert the following line after your Win32::OLE->new call: die "can\'t create Excel application: $!" unless ref $xl_app eq 'Win32::OLE'; **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs