Hi,

I set up a userform that lists the content of a folder in a combobox.
I want to use the value selected by the user in the combobox as the name of the new file in a change link function.
I am getting an error Method ChangeLink of object workbook failed.

Here is the OK command in the form to trigger the ChangeLink:

Sub OK_Click()


Select Case BBList.Value
Case "Select a BB"
Unload SelectionList
Exit Sub
Case Else
BBList.Value = BBVariant
End Select

Call ChangeLinks

Unload SelectionList

End Sub
I had declared the BBVariant as public as follows:

Public BBVariant As Long
Here is the ChangeLinks sub

Sub ChangeLinks()

    arrLinks = ActiveWorkbook.LinkSources(xlExcelLinks)
   
    
      
    If Not IsEmpty(arrLinks) Then
        'On Error Resume Next
        Application.DisplayAlerts = False
        For i = LBound(arrLinks) To UBound(arrLinks)
            ActiveWorkbook.ChangeLink arrLinks(i), BBVariant, xlLinkTypeExcelLinks
        Next i
        Application.DisplayAlerts = True
        End If
    
End Sub
Of course, if I leave the on error resume next in, then I don't get the error message but the link is not updated.

Many thanks for your help.

Dee