PDA

View Full Version : Update workbook



Klartigue
04-15-2014, 12:02 PM
One of my macros calls for opening a sheet named MMD Curve Input.xlsm. When it opens this sheet, there is a pop up that says this workbook contains links to other data sources, etc.. You have an option to press update, don't update, or cancel. Is there a way to tell my macro to press update? And then after I press update, another window pops up in which I need to press continue. Can I tell my macro to press update than continue? Or to push through all these popup windows?

ashleyuk1984
04-15-2014, 12:35 PM
Try putting this at the start of the macro.
(Application.DisplayAlerts)



Sub Macro()
Application.DisplayAlerts = False

blah blah blah....


End your macro with



blah blah blah....

Application.DisplayAlerts = True

End Sub

Klartigue
04-15-2014, 01:25 PM
I tired this but I still ended up having to press update once.


Sub OpenEarlyMidLateInput()
Application.DisplayAlerts = False

Workbooks.Open FileName:= _
"G:\Fixed Income\MMD Curve Input.xlsm"

Application.DisplayAlerts = False

End Sub

Simon Lloyd
04-15-2014, 01:29 PM
In the VBE type updatelinks in the serach and you should get some help there, you could stick this in the workbooks open event
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources

Simon Lloyd
04-15-2014, 01:31 PM
Ah just seen you are opening an external workbook, use this without the displayalerts code
Workbooks.Open FileName:= "G:\Fixed Income\MMD Curve Input.xlsm", UpdateLinks:=xlUpdateLinksAlways

Klartigue
04-15-2014, 02:20 PM
Workbooks.Open FileNmae:= _

"G:\Fixed Income\MMD Curve Input.xlsm", UpdateLinks:=xlUpdateLinksAlways


That works great, thank you.