How to confirm the open dialogue box by using macro coding?

E

Eric

Does anyone have any suggestions on macro coding on following situation?

Workbooks.Open Filename:="E:\1.xls", UpdateLinks:=3

When macro coding open the file 1.xls, it will update the links from the
data.xls.
In case, if the data.xls file is being connected or retrieved data by other
application, then the link for 1.xls file cannot be updated and a open
dialogue box pop up for file selection. Does anyone have any suggestions on
how to confirm the open dialogue box by using macro coding, which tries to
make a connection on every 3 seconds until a good connection is being made
for updating the data from data.xls ?

Does anyone have any suggestions?
Thank in advance for any suggestions
Eric
 
B

Barb Reinhardt

I wonder if using

Application.DisplayAlerts = False would work

You'd need to add

Application.DisplayAlerts = TRUE at the end
 
E

Eric

Thank you for your suggestions

If I add this statement, how should I add it?
I have 20 files to be opened one by one, I show 2 examples as below, which
one should I choose to add this statement?
Do you have any suggestions?
Thank for any suggestions
Eric


[Case 1]
Sub OpenFile()
Application.DisplayAlerts = False

Workbooks.Open Filename:="E:\1.xls", UpdateLinks:=3
Workbooks.Open Filename:="E:\2.xls", UpdateLinks:=3
....
End Sub

[Case 2]
Sub OpenFile()
Workbooks.Open Filename:="E:\1.xls", UpdateLinks:=3
Application.DisplayAlerts = False

Workbooks.Open Filename:="E:\2.xls", UpdateLinks:=3
Application.DisplayAlerts = False
....
End Sub
 
B

Barb Reinhardt

I'd try it with Case 1.

Eric said:
Thank you for your suggestions

If I add this statement, how should I add it?
I have 20 files to be opened one by one, I show 2 examples as below, which
one should I choose to add this statement?
Do you have any suggestions?
Thank for any suggestions
Eric


[Case 1]
Sub OpenFile()
Application.DisplayAlerts = False

Workbooks.Open Filename:="E:\1.xls", UpdateLinks:=3
Workbooks.Open Filename:="E:\2.xls", UpdateLinks:=3
...
End Sub

[Case 2]
Sub OpenFile()
Workbooks.Open Filename:="E:\1.xls", UpdateLinks:=3
Application.DisplayAlerts = False

Workbooks.Open Filename:="E:\2.xls", UpdateLinks:=3
Application.DisplayAlerts = False
...
End Sub



Barb Reinhardt said:
I wonder if using

Application.DisplayAlerts = False would work

You'd need to add

Application.DisplayAlerts = TRUE at the end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top