pankaj_it09 has asked for the wisdom of the Perl Monks concerning the following question:

Please tell me a solution to suppress password prompting of an excel file. I mean no window should open. Everything should happen in the background.
use Win32::OLE; my $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 0; $xlApp->{DisplayAlerts} = 0; # Open excel file. my $xlBook = $xlApp->Workbooks->Open("C:\\Documents and Settings +\\username\\Desktop\\testfile.xls"); my $Sheet1 = $xlBook->Worksheets(1); my $row = 1; my $col = 1; $Sheet1->Cells($row,$col)->{'Value'} = 5; if (Win32::OLE->LastError) { print "File protected"; } $xlBook ->Close(); undef $xlBook;

Replies are listed 'Best First'.
Re: Suppressing password prompting of an excel file.
by NetWallah (Canon) on Feb 21, 2009 at 00:03 UTC
    According to the MSDN Documentation, you can pass the password as a parameter to the open:

    Password (Optional)
    Variant A string that contains the password required to open a protected workbook.
    If this argument is omitted and the workbook requires a password, the user is prompted for the password.

         ..to maintain is to slowly feel your soul, sanity and sentience ebb away as you become one with the Evil.