tomkonec
Technical User
- Mar 22, 2001
- 25
I would like to change the data source of an Excel spreadsheet to look to a different Microsoft SQL server location.
I have been given this macro however it does not seem to do anything when I run it:
------------------------------------------
Sub tom()
Dim qt As QueryTable
Dim sNew As String
Dim i As Integer
Dim j As Integer
For i = 1 To Sheets.Count
For j = 1 To SheetsCount - 1
For Each qt In Sheets(j).QueryTables
sNew = InputBox("Edit the String:", , qt.Connection)
If sNew <> "" And sNew <> qt.Connection Then
qt.Connection = sNew
End If
Next
Next j
Next i
End Sub
---------------------------------------------
I have also found a Microsoft K-base article 327572 however this only refers to Pivot Tables.
How can I do this?
I have been given this macro however it does not seem to do anything when I run it:
------------------------------------------
Sub tom()
Dim qt As QueryTable
Dim sNew As String
Dim i As Integer
Dim j As Integer
For i = 1 To Sheets.Count
For j = 1 To SheetsCount - 1
For Each qt In Sheets(j).QueryTables
sNew = InputBox("Edit the String:", , qt.Connection)
If sNew <> "" And sNew <> qt.Connection Then
qt.Connection = sNew
End If
Next
Next j
Next i
End Sub
---------------------------------------------
I have also found a Microsoft K-base article 327572 however this only refers to Pivot Tables.
How can I do this?