Hi am am trying to see if there is vba code to refresh a query that is a "Connection Only"
i have the below code i am using but i am not seeing the query refresh when i go step by step in the code
i have the below code i am using but i am not seeing the query refresh when i go step by step in the code
VBA Code:
Sub RefreshSpecificQueries()
Dim queryList As Variant
Dim i As Integer
Dim conn As WorkbookConnection
' Add your query names to this array
queryList = Array("Query - filepath_Data", "Query - filepath_Dataset")
On Error Resume Next
For Each conn In ThisWorkbook.Connections
For i = LBound(queryList) To UBound(queryList)
If conn.Name = queryList(i) Then
conn.OLEDBConnection.BackgroundQuery = False
conn.Refresh
End If
Next i
Next conn
End Sub