Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

by ganeshabelavadi (Novice)
on May 13, 2011 at 11:16 UTC ( #904647=note: print w/replies, xml ) Need Help??

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

Hi, Even I'm facing same issue The error says "Win32::OLE(0.1709) error 0x80010108: "The object invoked has disconnected from its clients"" I'm calling the function twice which is having excel opening and closing commands. Please help how can I solve this issue?
  • Comment on Re^4: Win32::OLE called by subroutine only workes once

Replies are listed 'Best First'.
Re^5: Win32::OLE called by subroutine only workes once
by nll (Initiate) on Nov 29, 2012 at 15:27 UTC
    I've found Excel OLE to be quirky like this. My pseudo subclass suddenly stopped working due to this error, I found it was because the order of operations had changed. I made sure the following global operations happened before any book level or worksheet level op. happened.
    my $ex = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); if (not defined $ex) { die "couldn't get an instance of Excel"; } $ex->{DisplayAlerts}=0; $ex->{SheetsInNewWorkbook} = 1; $ex->{Visible} = 0 ; $Win32::OLE::Warn = 3; # Die on Errors.
Re^5: Win32::OLE called by subroutine only workes once
by Anonymous Monk on Mar 01, 2012 at 17:35 UTC
    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

      Thank you very much, this worked for me!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://904647]
[Corion]: 1nickt: No, I'm using it with Windows 10, but with the 4k display, yes. It's a very nice build IMO, and relatively sturdy. Also, it got 8 or 9 on the ifixit repair scale, which I consider good
[Corion]: ... especially as I expect to have to replace the battery set in two or three years' time
[1nickt]: Nice. So happy that Dells are still user-repairable. Unusual these days.
[1nickt]: I will certainly not be buying any more Macs.
[Corion]: 1nickt: Yeah, or at least, I hopoe so ;)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-03-27 13:15 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.