unless (defined $excel) { eval { $excel = Win32::OLE->GetActiveObject('Excel.Application') }; die "Excel not installed" if $@; } unless (defined $excel) { $excel = Win32::OLE->new('Excel.Application', 'Quit') or die "Oops, cannot start Excel"; } #to avoid excessive dialogs when saving in non-Excel format $excel->{DisplayAlerts} = 0; #$excel->Workbooks->Open({ FileName => $fullname_input_file }) #|| print STDERR "didnt open the file $!\n"; # get a new workbook my $wbook; if($wbook = Win32::OLE->GetObject($fullname_input_file)){;} else { $wbook = $excel->{Workbooks}->{"$fullname_input_file"}; if($wbook->Activate()){;} else { print STDERR "Could not open the file $fullname_input_file: $!\n"; exit; } } #### Win32::OLE(0.1709) error 0x800401e6: "Bad extension for file" at olelib.pl line 1286. eval {...} called at olelib.pl line 1286 main::save_excel_file_as_tab_delimited_MS_API_WSC('test2.xls', '__read_in_excel_file_into_array.txt', 'ANNOUNCEMENT') called at olelib.pl line 411 main::save_excel_file_as_tab_delimited('test2.xls', '__read_in_excel_file_into_array.txt', 'ANNOUNCEMENT') called at olelib.pl line 1970 main::read_in_excel_file_into_array_WSC('test2.xls', 'ARRAY(0x2b4a334)', 'ANNOUNCEMENT') called at olelib.pl line 1798 main::read_in_excel_file_into_array('test2.xls', 'ARRAY(0x2b4a334)', 'ANNOUNCEMENT') called at test_unzip_in_place.pl line 107 Win32::OLE(0.1709) error 0x80020009: "Exception occurred" in METHOD/PROPERTYGET "c:\ecdev\src\src_dev\model\sq\scripts\test\test_unzip\test2.xls" at olelib.pl line 1297. Can't call method "Activate" on an undefined value at olelib.pl line 1298.