Updating Links with a New File Location : Workbook Links « Excel « VBA / Excel / Access / Word






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

1.Link Status Checker
2.Checking the Status of All the Links in a Workbook