in reply to Re: Unprotect source code from Excel files with perl
in thread Unprotect source code from Excel files with perl
What is very important here and make things work is sleep(1). It gives time to enter the password and unprotect the project which is the key for the rest of my program. Thanks for your help :) Regards.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); } ...
|
|---|