I'm using Win32::IE::Mechanize to download a bunch of Excel files. Because of proxy/firewall issues, I'm stuck with this method.

The problem I'm having is that I can't seem to turn off ALL the warning dialog boxes that pop up when I try to save the displayed Excel file.

So far my code looks more or less like this:

my $spider = Win32::IE::Mechanise->new(); my $agent = $spider->{'Agent'}; my $Excel = Win32::OLE->GetActiveObject ('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Excel->{'DisplayAlerts'} = 0; LINE: while (<LINKS>) { ## Read $link and $title from filehandle ## this part works so I've left it out print "Getting link '$link'... "; $spider->get($link); print "ok\n"; print "Saving file as '$title'... "; my $doc = $agent->{'Document'}; $doc->SaveAs($title); print "ok"; }

The document saves fine, and setting DisplayAlerts to false turns off the dialog boxes that pop up then.

But when the script tries to navigate to the next file, or to any other page, another dialog box pops up that says "This document has been modified. Do you want to save your changes?".

This dialog box doesn't seem to be suppressed by either the Excel.DisplayAlerts property, or by the Silent property of the InternetExplorer object.

How do I get this box to go away?

Thanks!


In reply to Suppressing dialog boxes in Win32::OLE, InternetExplorer, and Excel by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.