use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; my $filename = 'book1.xls'; my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new('Excel.Application', 'Quit'); # use the Excel application if it's open, otherwise open new my $Book = $Excel->Workbooks->Open( $filename ); # open the file $Excel->Run("macro_name"); $Book->Save; #optional - save any changes made by the macro $Book->Close;