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

I was trying to write a Perl program to create and add-to an Excel spreadsheet using win32::ole.

The problem occurs when I try to open the spreadsheet. I think my antivirus is trying to look at it first and slows down the "opening" so that the windows interface fails to open the file. The reason I think so, is that I can put a breakpoint before the open, go to the Excel application and open the file, close the file, and then continue with the program. If I do this, the program is able to open the file, otherwise it fails.

Is there any way to put a time value into the win32::ole process to allow for the antivirus to check while opening the program?

my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); my $Book; $Excel->{Visible} = 1 ; print "$fileName \n" ; unless ($Book = $Excel->Workbooks->Open("$fileName") ) { print "can't open spreadsheet $fileName \n" ; }

Replies are listed 'Best First'.
Re: win32::ole and antivirus clash
by cdarke (Prior) on Feb 16, 2010 at 20:17 UTC
    Are you sure you problem is caused by anti-virus software? I ask because there is a well-known issue with opening files in Office when you have an unsatisfied shared network drive. Removing the shared drive suddenly speeds up the open. Its worth a look.

      I am doing it all on one computer - no shared drives