'Update formulas/links for all the open source workbooks
Sub Update_Links()
For Each wbkPath In ThisWorkbook.LinkSources
'Update formulas/links for all the closed source workbooks
If Not IsWorkbookOpen(wbkPath) Then
ThisWorkbook.UpdateLink Name:=wbkPath, Type:=XlLinkType.xlLinkTypeExcelLinks
End If
Next
End Sub
Public Function IsWorkbookOpen(sFileName) As Boolean
On Error Resume Next
Open sFileName For Binary Access Read Lock Read As #1
Close #1
IsWorkbookOpen = IIf(Err.Number > 0, True, False)
On Error GoTo 0
End Function