VBA that runs Sub after Data Refresh All completes

KatiL

New Member
Joined
Aug 30, 2022
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I am a VBA hack and not formally trained.. so apologies if I am confusing or unclear.

I need to create VBA code that notices when Data Refresh All completes. Once complete, it would run a VBA sub from Module1 that I have already created and tested. When complete, I would like a message box to indicate that "Data Refresh All successfully completed. All Import Tabs have been updated to include only refreshed data."

From reading through the responses in other threads I think I need to add some code to a Class Module and to ThisWorkbook. I have included a snip of what I think MIGHT be the correct Class Module code.. but I couldn't wrap my head around what would go in ThisWorkbook... and I am not sure if the Class Module code is correct since I cannot test it until the rest of the code is written.

In case you need to know, the Power Queries that would run are:
TSDATA
eCMS_TCI_DATA
BILLING_DATA
CLEARION_DATA
TS_W_ERRORS

The VBA Sub I need to run is called
ALL_IMPORTS_CLEAR_AND_AUTOFILL_FORMULAS
 

Attachments

  • Ameren V&TCI Class Module.jpg
    Ameren V&TCI Class Module.jpg
    109.5 KB · Views: 46
I restarted Excel and it worked! Sorry I didn't try that sooner... Thanks for all your help!
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I'm glad you got it working.

Still no MsgBox.

I added the above code and ran it. When processing stopped, I hit F5 which popped up a "Go To" box with each Query Table listed. Nice to be able to see all my queries in a list and navigate to them, but that's not what I need at this time. I am not sure why adding a Stop would make the MsgBox work and I do not want users to have to take another step to reset tables.

You were pressing F5 in the wrong context - the Excel UI - there. To clarify, the Stop line in the code was for debugging purposes only, to see if that part of the code was being executed. When the Stop is reached, the running code is interrupted in the VBA editor and you can press F5 to continue the execution.
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top