use Win32::OLE qw(in with); use Win32::OLE::Const ('Microsoft Excel'); my $excel = Win32::OLE->CreateObject('Excel.Application') || Win32::OLE->new( 'Excel.Application', 'Quit' ); my $wrk_book = $excel->Workbooks->Open('C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/TestWeb/test.xlsm'); $excel->Run('CreateAdhocMDL',$arg1,$arg2, $filename ); $excel->{Visible} = 1; $excel->$wrk_book->SaveAs("C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/LFWeb/$filename"); $excel->Close();