sub OpenAndSaveXLS{ (my $xlsfile)=@_; if((-e $xlsfile) and (!isFileInUse($xlsfile))){ $xlsfile =~ s/\//\\/g; print "xls: ".$xlsfile . "\n\n"; my $ex_ol = Win32::OLE::Const->Load("Microsoft Excel 12.0 Object Library"); my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new('Excel.Application', 'Quit'); $Excel->Application->{DisplayAlerts} = 0; my $book = $Excel->Workbooks->Open("$xlsfile"); $Excel->ActiveWorkbook->SaveAs({FileName=>"$xlsfile", FileFormat=>$$ex_ol{'xlWorkbookNormal'}}); $book->Close(); $Excel->Quit(); return 0; } }