Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel update automatic links prompt

Status
Not open for further replies.

coppertom

Programmer
Joined
Aug 12, 2002
Messages
5
Location
US
I am using Excel automation to open an Excel file and extract data from a worksheet. However, if a file has a worsheet with linked cells, I get a message stating 'The workbook you opened contains automatic links to information in another workbook. Do you want to update this workbook with changes made to the other workbooks?' I have to click 'Yes' or 'No to continue running my application. Is there a property I can set so I am not prompted when I open a workbook with links? I can manually open Excel, go to the menu option Tools --> Options --> Edit and uncheck the box 'Ask to Update Automatic Links', but I would like to be able to turn it off in code and turn it back on when I'm done.

TIA,
Tom
 
ox=CREATEOBJECT("Excel.application")
ox.Workbooks.Add
ox.DisplayAlerts
ox.DisplayAlerts=.f.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
sorry that should read:
ox=CREATEOBJECT("Excel.application")
ox.Workbooks.Add
ox.DisplayAlerts=.f.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Is there anything I can do for an Excel workbook that has already been created by a user? I am just extracting data and not actually creating a worksheet in code.
 
coppertom

Try this, set the DisplayAlerts at the application level.

Code:
ox=CREATEOBJECT("excel.application")
ox.DisplayAlerts=.t.
oWb=ox.Workbooks.Open("c:\book2.xls")
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike

I tried that after your first post, but I couldn't get that to work. I then tried opening Excel, setting DisplayAlerts = .F., closing Excel, and opening Excel again but that didn't work either.
 
coppertom

The DisplayAlerts is mostly for more regular things like "overwritng and existing file" or closing without saving. I don't think there is a solution for a link issue. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I wasn't sure if there was either. Thanks for your help.
 
Just in case others have this problem, in code before opening the file use Application.AskToUpdateLinks = False then load the file, then to resort the default use Application.AskToUpdateLinks = TRUE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top