Update Links Stopping Workbook_Open Routine

J

John Cole, Jr.

I posted a similar request with no request. I'm hoping someone has
seen this problem and has a way to fix it. I have a spreadsheet that
I'm opening that contains a workbook_open routine as well as Links to
external workbooks. I have turned off the AskForLinkUpdates.
However, I still get the dialog that states some of the links could
not be updated. It gives me teh option to choose "Continue" or "Edit
Links". If I choose "Continue", the routine runs normally, and I
don't have any issues. If I choose "Edit Links", it stops the
routine. How can I make Excel continue on the macro no matter what is
chosen? I've attached my code for reference.

Private Sub Workbook_Open()
'Place in ThisWorkbook of all Excel Supports
MsgBox ("You Must Press Continue on the following Prompt.")
Application.AskToUpdateLinks = False
Application.DisplayAlerts = False

'Install AddIn
On Error GoTo addInError
Application.AddIns.Add Filename:=APPFullPathName, CopyFile:=False
Application.AddIns(APPNAME).Installed = True
On Error GoTo 0

'Open DataBook
On Error GoTo DataBookError
Dim moduleLineList As Object
Set moduleLineList = GetObject(DataBookFullName)
On Error GoTo 0

'Reset Links
ThisWorkbook.Activate
ChDir APPPath
ActiveWorkbook.ChangeLink Name:=APPFileName, NewName:=APPFileName,
Type:= _
xlExcelLinks
Application.AskToUpdateLinks = False



'Reset Application Variables
ActiveWindow.Visible = True
Application.DisplayAlerts = True

'exit
Exit Sub

'Error Handling
addInError:
MsgBox ("The " & APPNAME & " AddIn isn't in the correct directory, or
it isn't named correctly." & vbCr & _
"Place it in the directory as follows and re-open this Support
File." & vbCr & APPFullPathName)
GoTo ExitAfterErrorMsg

DataBookError:
MsgBox ("The " & DataBook & " file could not be found in teh correct
directory, or it isn't named correctly." & vbCr & _
"Place it in the directory as follows and re-open this Support
File." & vbCr & DataBookFullName)
GoTo ExitAfterErrorMsg

ExitAfterErrorMsg:
ThisWorkbook.Close
Application.DisplayAlerts = True
Application.AskToUpdateLinks = False
Exit Sub

End Sub
 
M

michael.beckinsale

John,

In xl2003

I dont know if you want to update the links or not but this code will
stop the links being updated when the workbook is opened. I have not
tested the code but if the dialog box is displayed use
Application.DisplayAlerts = False.

The other constants used can be found in VBA help

ActiveWorkbook.UpdateLinks = xlUpdateLinksNever

Regards

Michael beckinsale
 

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