Repeat macro on time interval

tradespy

New Member
Joined
Jan 16, 2008
Messages
3
I have created a macro that I would like to be ran every 10 seconds. The macro, if ran manually runs a web query. The web query has a setting that can be ran every 1 minute automatically. I need the web query to run every 10 seconds. I am not a VBA programmer so any help would be appreciated. Thanks.:biggrin:
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
tusharm - thanks for the reply. i used the code suggested but now i'm getting an error when it is ran. again, i'm not a programmer so this is new to me. any help would be appreciated. thanks.

Sub StartTimer()
RunWhen = Now + TimeSerial(0, 5, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, Schedule:=True
End Sub
Sub The_Sub()
Selection.QueryTable.REFRESH BackgroundQuery:=False
StartTimer
End Sub

Run-time error '1004':

Method "OnTime' of object_Application' failed
 
Upvote 0
On Chip's page, look at the declarations above the StartTimer procedure.

Also, you changed the TimeSerial arguments. You should look up Excel VBA help to understand the implication of the change.
 
Upvote 0
I think I got it to work. I see what I missed. So far it is freshing the page but until the webpage that is being quered is up (Tuesday - Stock Ticker) and running I won't know. Thanks again. This is a great website.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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