'Best option to refresh a single query using VBA
I have a workboook with 4-6 queries and I just would like to refresh 1 of the 6 with VBA. My question is, am I using the fastest option below?
And nope, I don't want to use the Refresh All / Refresh button within Excel, I needed to include this in a sub.
CODE:
ThisWorkbook.Connections("Query - Raw").OLEDBConnection.refresh
' THESE ALSO WORK
' ActiveWorkbook.RefreshAll
' Selection.ListObject.QueryTable.refresh BackgroundQuery:=False
These don't work:
ActiveWorkbook.Connections("Raw").refresh
ThisWorkbook.Connections("Raw").refresh
Thank you for the kind answers in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
