Suresh Govindachar wrote:
Hello,
Issue: opening an excel file brings up a dialog box
stating that the "workbook contains links to
other data sources" and asks if the data
should be updated.
Just-in's suggestion of adding "$Excel->{DisplayAlerts} = 0;"
to modify the code to be:
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
my $Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
Win32::OLE->new('Excel.Application', 'Quit');
$Excel->{DisplayAlerts} = 0;
my $Book = $Excel->Workbooks->Open($file); # open Excel file
my $Sheet = $Book->Worksheets(1); # select worksheet number 1
$Book->Close;
did not enable the perl code to prevent Excel from bring up
that dialog box.
Just-in's other suggestion was "If not you may have to fudge
something with Win32::GuiTest", but didn't elaborate on
the "something" ...
So one thought is to have two threads -- one thread is as
above; the other thread periodically searches for
appearence of the Excel dialog box, and when it finds one,
uses SendKeys to get rid of the box.
Before I actually try the above scheme, any critique on
it? or any other suggestions?
Thanks,
--Suresh
my $Book = $Excel->Workbooks->Open($file, {'UpdateLinks' => 3});
The value 3 I got from some VB code someplace I forget, and have
no clue what it means - hunted on MSDN to no avail. Anyone?
BTW Options to book->Open are fully listed in the Object Browser.
HTH - Lynn.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs