use Win32::OLE qw(in with); ... $Excel = Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{Visible} = $vttrue; $oBook = $Excel->Workbooks->Open("wishyouwerehere.xls"); ... if ($oBook->VBProject->{Protection} == 1) { $Excel->VBE->CommandBars->FindControl({ID=>2578})->Execute; $Excel->SendKeys ($pass); $Excel->SendKeys ("{ENTER}"); $Excel->SendKeys ("{ESC}"); sleep(1); } ...