Forum Discussion
PowerBI_Query
Helper II
4 years agoBackground Query Completion
I have created a VBA code to import data from CSV convert it into a table and refresh the query that is already setup. I want the user to be informed when the background query is completed by displa...
- 4 years ago
Posted the question on VBA forum and got the below solution it works flawless.
With ThisWorkbook For Each objConnection In .Connections 'Get current background-refresh value bBackground = objConnection.OLEDBConnection.BackgroundQuery 'Temporarily disable background-refresh objConnection.OLEDBConnection.BackgroundQuery = False 'Refresh this connection objConnection.Refresh 'Set background-refresh value back to original value objConnection.OLEDBConnection.BackgroundQuery = bBackground Next 'Save the updated Data '.Save End With MsgBox "Completed"
jbwtp
Memorable Member
4 years agoHi PowerBI_Query,
You need to capture QueryTable_AfterRefresh event in VBA. How to do it is quite separate question. Search on the Internet as non-standard events may at time be quite complicated, it depends on the scenario you would like to implements, etc.
Kind regards,
John