Brian W Smith wrote:
>Fellow Users,
>I have a script which uses Win32::OLE and Win32::OLE::Variant to open an existing 
>Excel workbook, select a particular worksheet, read it and then close the workbook.
>The following snippet illustrates this:
>use MyStuff;                                 # home made package of
>straightforward subroutines
>use MyStuff::Docs;                           # a new ditto.
>my $excelfile           = "fred.xls";
>my $Excel               = Win32::OLE->new("$excelfile");
>$Excel->{Visible}       = 0;                 # don't want to see any excel
>windows thank-you
>$Excel->{DisplayAlerts} = 0;                 # don't want any alerts
>either - we're only reading it
>my $readonly            = Win32::OLE::Variant->new(VT_BOOL,1);
>my $false               = Win32::OLE::Variant->new(VT_BOOL,0);
>my $workbook            = $Excel->Workbooks->Open("$excelfile",0,$readonly);
>my $sheet               = $workbook->Worksheets("Sheet1");
>my $everything          = $sheet->UsedRange()->{Value};       # read entire
>sheet
>$Excel->Workbooks->Close($false,"$excelfile");
># this doesn't work anymore !!!
>$Excel->Quit;

It seems you can use:

$workbook->Close($false,"$excelfile");
or
$workbook->Close({SaveChanges=>$false, FileName=>$excelfile});
or
$Excel->Workbooks($excelfile)->Close($false,"$excelfile")
or 
$Excel->Workbooks($excelfile)->Close({SaveChanges=>$false, FileName=>$excelfile});
or
$Excel->Workbooks->Close; # it closes all workbooks opended

but you cannot use 

$Excel->Workbooks->Close($false,"$excelfile");  for Close method for Workbooks 
collection has no parameters allowed.

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

Reply via email to