Updating Links with a New File Location
Sub FixLinks(wb As Workbook, sOldLink As String, sNewLink As String)
Dim avLinks As Variant
Dim nIndex As Integer
avLinks = wb.LinkSources(xlExcelLinks)
If Not IsEmpty(avLinks) Then
For nIndex = 1 To UBound(avLinks)
If _
StrComp(avLinks(nIndex), sOldLink, vbTextCompare) = 0 Then
wb.ChangeLink sOldLink, sNewLink, xlLinkTypeExcelLinks
Exit For
End If
Next
End If
End Sub
Related examples in the same category