Modify existing excel Connection Name in VBA
问题 I need to update the Connection Name of an excel workbook's sql connection. This is my attempt. I have been able to modify the Connection String and Command Text by doing a standard replace. Sub ConnectionString_modify() Dim i As Long Dim cnt As Long Dim modtext As String Dim modrange As String 'Grab nummber of workbook connections cnt = ActiveWorkbook.Connections.Count For i = 1 To cnt 'Changes to Connection string --This works modtext = ActiveWorkbook.Connections.Item(i).OLEDBConnection