[Sorry again, left out the most important part] Const xlUpdateLinksUserSetting = 1 Const xlUpdateLinksNever = 2 Const xlUpdateLinksAlways = 3
-----Original Message----- From: Jarvis, John Sent: Thursday, April 20, 2006 11:03 AM To: 'Lynn. Rickards'; Suresh Govindachar Cc: [email protected] Subject: RE: Opening an Excel workbook with links to other data sources [Sorry for the top post, only got a few seconds to get this in...] For what it's worth, the Excel 2003 VBA Help offers this clue to the 'UpdateLinks': UpdateLinks Property Returns or sets an XlUpdateLink constant indicating a workbook's setting for updating embedded OLE links. Read/write. XlUpdateLinks can be one of these XlUpdateLinks constants. xlUpdateLinksAlways Embedded OLE links are always updated for the specified workbook. xlUpdateLinksNever Embedded OLE links are never updated for the specified workbook. xlUpdateLinksUserSetting Embedded OLE links are updated according to the user's settings for the specified workbook. expression.UpdateLinks expression Required. An expression that returns a 'Workbook' object Example In this example, Microsoft Excel determines the setting for updating links and notifies the user. Sub UseUpdateLinks() Dim wkbOne As Workbook Set wkbOne = Application.Workbooks(1) Select Case wkbOne.UpdateLinks Case xlUpdateLinksAlways MsgBox "Links will always be updated " & _ "for the specified workbook." Case xlUpdateLinksNever MsgBox "Links will never be updated " & _ "for the specified workbook." Case xlUpdateLinksUserSetting MsgBox "Links will update according " & _ "to user settting for the specified workbook." End Select End Sub -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lynn. Rickards Sent: Wednesday, April 19, 2006 6:02 PM To: Suresh Govindachar Cc: [email protected] Subject: Re: Opening an Excel workbook with links to other data sources 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 _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
