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"
edhans
Community Champion
4 years agoI am not aware of this being possible. There is no trigger from Power Query refreshing in the background that the VBA object model can pick up on, but to be 100% sure your best bet is in the VBA forums of the Excel groups. This is a Power BI forum and it doesn't have, nor will ever have, VBA.