Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: win32::ole excel savechanges

by opitzs (Sexton)
on Jan 10, 2012 at 09:26 UTC ( #947119=note: print w/replies, xml ) Need Help??

in reply to win32::ole excel savechanges

I have no experience with Win32::OLE, but the Excel-Interface itself should give you something like: $wb->Saved = 1; to change the state of the workbook. If the saved state is true, Excel doesn't bother asking anymore. Sorry I can't be of more help, but right now I am exclusively on Linux, so I can't test it.

Replies are listed 'Best First'.
Re win32::ole Excel 2016 quit without saving
by Ratazong (Monsignor) on Aug 02, 2018 at 12:51 UTC

    Dear monks!

    I currently had a similar problem (reading data from ~100 Excel-sheets), and of course I didn't want to manually click a dialog after each of them. Excel 2013 successfully detected that I was only reading them, however when migrating to Excel 2016, the annoying dialog appeared. Using the solution above prevents that dialog in Excel2016 :-)

    Below is my code for your reference

    Hope this helps! Rata

    my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); my $workbook = $Excel->Workbooks->OpenXML("someNameHere"); # + open file # some code here, only _reading_ from that workbook $Excel->{DisplayAlerts} = 0; # 1. not required for Exce +l 2013 $workbook->{Saved} = 1; # 2. not required for Exce +l 2013 $workbook->close(0); $Excel->Workbooks->Close();
Re^2: win32::ole excel savechanges
by Anonymous Monk on Jan 10, 2012 at 13:58 UTC
    Thanks that seems to work, the syntax requires {} round the 'Saved'. $wb -> {Saved} = 1; $wb -> Closed(0) ; works without producing a dialogue box. Davud

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-06-06 19:48 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (29 votes). Check out past polls.