Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Newbie22
Resolver I
Resolver I

VBA MsgBox AFTER Background Query Completion

Hi!

 

Is it possible to create a message box that will show if the refreshing/loading of Queries are completed?

 

Right now, I'm just looking at the bottom part of my Excel to know if it's still loading. I'd like to know if I can create a message box that will pop up once loading is done.

 

Newbie22_1-1693308376852.png

Here's my VBA code:

 

Sub RefreshAll()
'
' RefreshAll Macro
'
' Keyboard Shortcut: Ctrl+Shift+R
'
ActiveWorkbook.RefreshAll

End Sub

1 REPLY 1
Martin_D
Super User
Super User

Hi @Newbie22 ,

 

you have 2 options to achieve this:

 

  1. f you don't want to continue working in Excel while the refresh is ongoing, then you can turn off background refresh for each query and so the next line of code after RefreshAll(), which could be a MsgBox, will only execute after refresh is done.
     
    Martin_D_1-1693326210200.png 
  2. If you want to continue working in Excel while RefreshAll() is executing in the background, then you can implement an AfterRefresh event handler for each query. Once refresh has finished for all refreshes, e.g. count how many AfterRefresh Events already occured, then finally show the message box. Example see here: http://www.vbaexpress.com/forum/showthread.php?30743-DoEvents-ActiveWorkbook-RefreshAll-Run-second-p...

BR

Martin

github.pnglinkedin.png

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors