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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic links in Excel 1

Status
Not open for further replies.

mal2ty

Technical User
Jun 25, 2001
28
US
I'm working on automating an Excel report. Each time this Excel report is opened, Excel displays the following message box:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
workbook?

To update all linked information, click Yes.
To keep the existing information, click No.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

How can I use VBA to automatically select "No" when the Excel report is opened?
 
Ret = MsgBox("MyPrompt", vbOKCancel + vbDefaultButton2, "MyMsgBoxTitle")

Code:
Syntax
MsgBox(prompt[, buttons] [, title] [, helpfile, context])

The buttons argument settings are:
...
vbDefaultButton1 /0 /First button is default. 
vbDefaultButton2 /256 /Second button is default. 
vbDefaultButton3 /512 /Third button is default. 
vbDefaultButton4 /768 /Fourth button is default. 
...

ide :cool:
 

Workbook([MyWorkbook]).Open filename:=[MyName], UpdateLinks :=0(or 1,2 or 3)

Value Meaning
0 Doesn't update any references
1 Updates external references but not remote references
2 Updates remote references but not external references
3 Updates both remote and external references Store300

Store300@ftnetwork.com
 
This is something I am also interested in. But I have a question about this. Where in the workbook/module structure do you put this code so that if there are no files open at a given instant, that when you open your first file, this subroutine is loaded and running?

Thanks.
 
Thanks all. The answer Store300 provided best suits the situation, but the others also provided useful information. Here's a related question:

I'm updating one Excel workbook with data from a second Excel workbook. After pulling data from the second workbook, the second workbook is closed. Sometimes this results in the following message from Excel:

Do you want to save the changes you made to 'filename'?
Yes No Cancel

Is there a way to automatically select yes if this message occurs?
 
Workbook([MyWorkbook]).Close SaveChanges:=True Store300

Store300@ftnetwork.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top