J
John V
Here is the code from my worksheet that continually queries the web for stock
quotes:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "GetData" ' the name of the procedure to run
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=True
End Sub
Sub GetData()
<functioning web query stuff here>
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=False
End Sub
Questions:
1. I have occasion to want to halt execution to update portions of the
workbook. I envision some sort of Pause and Resume code to do this. Ideas?
2. How do I modify this code to run only during business hours?
Many thanks.
quotes:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "GetData" ' the name of the procedure to run
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=True
End Sub
Sub GetData()
<functioning web query stuff here>
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=False
End Sub
Questions:
1. I have occasion to want to halt execution to update portions of the
workbook. I envision some sort of Pause and Resume code to do this. Ideas?
2. How do I modify this code to run only during business hours?
Many thanks.