I have three tables which pull data from SQL database.
When I click refresh all from the data menu, the connections refresh but only sum of the tables are refreshed.
When I right-click>refresh the tables themselves, they reflect the correct information (telling me that the connection was refreshed indeed).
I tried ActiveBook.RefreshAll
and the following code too:
Dim wks As Worksheet
Dim qt As QueryTable
For Each wks In Worksheets
For Each qt In wks.QueryTables
qt.Refresh BackgroundQuery:=False
Next qt
Next wks
Set qt = Nothing
How can I refresh the table using VBA code?