Web Query to Trigger Macro

eforti

Board Regular
Joined
Aug 15, 2005
Messages
220
Hello All,
I am running a series of web queries in my workbook, which update every 5 minutes or so. I'd like to run a macro after each query to help with data management. Could someone please explain how this might be done? I already have the macro created, just don't know how to call it to open with an event.

Thanks in advance
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
See XL2000: How to Use the Query BeforeRefresh and AfterRefresh Events

It shows this code:
Code:
Dim X As New Class1

Sub Initialize_It()
  Set X.qt = Thisworkbook.Sheets(1).QueryTables(1)
End Sub
I haven't done this, but for multiple web queries (QueryTables) I think you would have to use an array or collection of Class1 objects, and loop through all QueryTables (in each sheet if they are in different sheets) to initialise each Class1 object.
 
Upvote 0
John_w,
Thanks for the response. This looks a little more complicated than some of the stuff I've tried in the past, but I'll have to read through your link to see how to tackle it.
 
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,652
Members
448,975
Latest member
sweeberry

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