Hi
My code crawls all external links and changes them, but it's only the last one that changes. Why is only the last and not all of them changed?
Yours sincerely
Michael
Private Sub cmdExecute_Click()
Dim wb As Workbook
Dim ExternalLinks As Variant
Dim i As Long
Set wb = ActiveWorkbook
ExternalLinks = wb.LinkSources(Type:=xlLinkTypeExcelLinks)
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
If VariantContent(ExternalLinks) = True Then 'Is there links?
For i = 1 To UBound(ExternalLinks)
wb.ChangeLink Name:=ExternalLinks(i), _
NewName:=Replace(LCase(ExternalLinks(i)), LCase(Me.txtOLD.Value), Me.txtNEW.Value), _
Type:=xlLinkTypeExcelLinks
Next
End If
Application.DisplayAlerts = True
Application.AskToUpdateLinks = True
Unload Me
End Sub