Skip to main content
Community site session details

Community site session details

Session Id : H7XSWt95QHka6Nz6z4rkqZ
Power Automate - Power Automate Desktop
Answered

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

Like (0) ShareShare
ReportReport
Posted on 6 May 2022 04:03:13 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!

  • cdlzs__ Profile Picture
    13 on 09 Jul 2024 at 19:07:30
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    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.

  • r96359 Profile Picture
    228 on 08 Jun 2022 at 05:23:41
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

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

  • Verified answer
    VJR Profile Picture
    7,635 on 20 May 2022 at 03:02:02
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    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 19 May 2022 at 15:52:37
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

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

  • r96359 Profile Picture
    228 on 19 May 2022 at 03:42:19
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

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

  • VJR Profile Picture
    7,635 on 19 May 2022 at 03:29:21
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    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 18 May 2022 at 19:23:03
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

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

    How did you find message box after completion unreliable? 

  • UK_Mike Profile Picture
    on 18 May 2022 at 17:04:13
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    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 18 May 2022 at 14:59:03
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    @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 18 May 2022 at 14:10:35
    Re: Use PAD to refresh specific queries from Excel Power Query and wait until refresh complete without VBA

    Ta daaaa 😁

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

     

     

    Screenshot 2022-05-18 150839.png

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete