The code replaces one Server Name with another Server Name in an Excel Connection.
Sub UpdateCONNECTIONS()
Dim CON As Variant, NewSERVER As String, OldSERVER As String, SvrConAVAL As Integer
If MsgBox("The action will requir you to have both, New & Old Server Name!", vbYesNo, "Server Name Confirm?") = vbNo Then Exit Sub
OldSERVER = InputBox("Please enter the new server name:", "New Server", "nbmsaadev01.mgmt.lab.eng.btc.netapp.in")
NewSERVER = InputBox("Please enter the new server name:", "New Server", "amsmsaapp02-prd.hq.netapp.com")
For Each CON In ActiveWorkbook.Connections
CON.OLEDBConnection.Connection = Replace(CON.OLEDBConnection.Connection, OldSERVER, NewSERVER)
Next CON
End Sub
Sub UpdateCONNECTIONS()
Dim CON As Variant, NewSERVER As String, OldSERVER As String
NewSERVER = "amsmsaapp02-prd.hq.netapp.com"
OldSERVER = "nbmsaadev01.mgmt.lab.eng.btc.netapp.in"
For Each CON In ActiveWorkbook.Connections
CON.OLEDBConnection.Connection = Replace(CON.OLEDBConnection.Connection, OldSERVER, NewSERVER)
Next CON
End Sub