Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by Anonymous Monk
on Mar 01, 2012 at 17:35 UTC ( [id://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

Replies are listed 'Best First'.
Re^6: Win32::OLE called by subroutine only workes once
by Anonymous Monk on Dec 23, 2016 at 21:13 UTC
    Thank you very much, this worked for me!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://957275]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found