web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Use PAD to refresh spe...
Power Automate
Answered

Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

(0) ShareShare
ReportReport
Posted on by 228

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!

  • r96359 Profile Picture
    228 on at

    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

  • UK_Mike Profile Picture
    on at

    Ta daaaa 😁

    I have to do something similar, run 3 separate macros with a wait in between.

     

     

    Screenshot 2022-05-18 150839.png

  • r96359 Profile Picture
    228 on at

    @UK_Mike 

    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

  • UK_Mike Profile Picture
    on at

    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.

  • r96359 Profile Picture
    228 on at

    My queries run from a few seconds to a few minutes. I needs something reliable.

    How did you find message box after completion unreliable? 

  • VJR Profile Picture
    7,635 on at

    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.

     

    • Go to Ribbon: [Data]
    • Click on [Connections]
    • Select the query you want to affect
    • Press [Properties]
    • Untick [Enable Background Refresh]

     

  • r96359 Profile Picture
    228 on at

    @VJR 

    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"

  • r96359 Profile Picture
    228 on at

    @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.

  • Verified answer
    VJR Profile Picture
    7,635 on at

    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.

  • r96359 Profile Picture
    228 on at

    @VJR Many thanks! Disabling the 'Background Refresh' setting did the job without the need for additional vba code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard