Anyone know how to target specific queries from Excel Power Query and wait until refresh complete without VBA?
I several queries I need to run one after another to refresh and then move to the next one.
How do you call on a query?
How do you wait for refresh to be complete?
I think the old answer for me would be to create vba code to refresh each specific query including a dialog box. Have PAD run the vba code and then wait for dialog box before going to next vba code for next query etc.
Any better way to get this done?
Thanks!
Hi @r96359 ,
My way of solving this issue was to focus on when the progress bar (that usually comes up on the right) disappears.
This implies that when you refresh data (from pivot, query, etc) the progress bar comes up,, when it finishes up refreshing, it disappears, that way you know it's been refreshed. It worked on my project.
@VJR Many thanks! Disabling the 'Background Refresh' setting did the job without the need for additional vba code.
Alright, post back how does it go with you on disabling the 'Background Refresh' setting.
Also there are macros on the web that can programmatically disable this but at first you can do it via the settings.
@VJR BTW My last ide of using "Application.CalculateUntilAsyncQueriesDone" doesn't seemt to work if power query is quering againt another worksheet table and not a external daetabase.
Thanks! I also just found for VBA using this statement after a query refresh makes it wait until the refresh is complete. I will try your idea as well.
"Application.CalculateUntilAsyncQueriesDone"
I have read that disabling background refresh makes the execution of the refresh macro pause until the query has completed and the data pulled in.
Can give it a try.
My queries run from a few seconds to a few minutes. I needs something reliable.
How did you find message box after completion unreliable?
Wait for x seconds as its unreliable waiting for the macro text on screen to finish.
Ive got circa 30 workbooks, 3 separate macros are stored in personal workbook.
So, for each workbook, refresh 1, wait 10 seconds, refresh 2, wait 10 seconds, refresh 3, wait 10 seconds.
Only takes a minute to open, 3 refreshes, 3 waits, save and close.
Hi there,
How are you waiting for the refresh to complete?
Is there an intelligent way to handle this or are you just waiting for x seconds?
Thanks
Ta daaaa 😁
I have to do something similar, run 3 separate macros with a wait in between.
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2