Hi,

I have found some code that can find and replace part of hyperlinks in Excel.
Works like a charm, but it seems som url's are too long for the msgbox and then I get an "Out of memory" error

Can someone edit the code to skip the msgbox and still change the url or add a Userform, cause the users really like to see
what they change

The code I found is this

Sub changeLinks()



  Const oldPrefix = "oldurl/"
  Const newPrefix = "newurl/"
  Dim h As Hyperlink, oldLink As String, newLink As String




  For Each h In ActiveSheet.Hyperlinks
       'this will change Address but not TextToDisplay
       oldLink = h.Address
      Debug.Print "Found link: " & oldLink
      If Left(oldLink, Len(oldPrefix)) = oldPrefix Then
              newLink = newPrefix & Right(h.Address, Len(h.Address) - Len(oldPrefix))


              If MsgBox("Click OK to change:" & vbLf & vbLf & oldLink & _
                 vbLf & vbLf & "to" & vbLf & vbLf & newLink, vbOKCancel, _
                 "Confirmation?") <> vbOK Then Exit Sub


              h.Address = newLink
              Debug.Print "  Changed to " & h.Address
      End If
  Next h


 End Sub