# get a new workbook my $wbook; $wbook = $excel->Workbooks->Open({ FileName => $fullname_input_file }); $wbook->Save(); unless(defined $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; } } }