Thread: On Time
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default On Time

You don't start the timer in the ontime procedure, you start it outside. The
OnTime will run that procedure after the specified delay.

Public RunWhen As Double
Public Const cRunIntervalSeconds = 30
Public Const cRUnWhat = "Macro2"

Sub Invokee()
StartTimer
End Sub

Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime = RunWhen, procedu=cRUnWhat,
schedule:=True
End Sub


Sub Macro2()
My code
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Henry" wrote in message
...
I am using On Time routine from Chip Pearsons site as Follows:

Public RunWhen As Double
Public Const cRunIntervalSeconds = 30
Public Const cRUnWhat = "Macro2"

Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earlisttime = RunWhen, procedu=cRUnWhat,

schedule:=True
End Sub


Sub Macro2()

My code

StartTimer

End Sub


Where do I sore the code and how do I actually start the procedure/
Thanks!