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!
Solved! Go to Solution.
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.
Really suprised there is no response on this question.
Is VBA code required to acomplish the ability to target a Power Query refresh?
Any suggestions on the best way to hande this?
Thanks
Ta daaaa 😁
I have to do something similar, run 3 separate macros with a wait in between.
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
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.
My queries run from a few seconds to a few minutes. I needs something reliable.
How did you find message box after completion unreliable?
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.
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"
@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.
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 Many thanks! Disabling the 'Background Refresh' setting did the job without the need for additional vba code.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.