Hi,
I finally found a solution to my problem. This is what I do:
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);
}
...
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.
|