Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^5: Win32::OLE called by subroutine only workes once

by Anonymous Monk
on Mar 01, 2012 at 17:35 UTC ( #957275=note: print w/replies, xml ) Need Help??

in reply to Re^4: Win32::OLE called by subroutine only workes once
in thread Win32::OLE called by subroutine only workes once

I'm writing a script which opens each excel file in a directory, reads some values from the workbook, then closes the workbook, and I had the same problem of Excel quitting when I closed the workbook.

The inspiration came when I noticed the problem did not happen if I manually opened Excel first (with the default, blank "Book1")

The work-around I used was to create a new workbook first, process all the files, (open, close, open, close...) then close my "KeepOpen" workbook when I was all done:

$KeepOpen = $Excel->Workbooks -> Add; # your code / loop here $KeepOpen -> Close;

Hope this helps,
-- zaaj

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://957275]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2016-12-07 16:47 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (130 votes). Check out past polls.