B
BruceJ
I am trying to get an ontime routine working.
Here are my questions...
Will it only run MACROS? or can it run a sub function
Where do I decalre the PUBLIC varibles
I tried to following in one of the modules (a_publicStuff):
Public NextTime As Double 'to setup 15 minute time
Public Const cRunIntervalSeconds = 900 ' 15 minutes
Public Const cRunWhat = "settimer_Click"
(if I put the above in my usercode area, the last two turn red)
and the following is in my userform code area.
Sub StartTimer()
'RunWhen = NextTime
Application.OnTime earliesttime:=NextTime, procedure:=cRunWhat, _
schedule:=True
End Sub
Sub settimer_Click()
MsgBox Format(Application.RoundUp(Time * 96, 0) / 96, "hh:mm:ss")
NextTime = NextTime + cRunIntervalSeconds
MsgBox cRunIntervalSeconds
MsgBox Format(NextTime, "hh:mm:ss")
End Sub
When I run my form, I get an error saying the macro can not be found.
If I create a macro with the name, it functions, but the nexttime does not
get incremented, and cRunIntervalSeconds is 0:00
Thanks
Bruce
Here are my questions...
Will it only run MACROS? or can it run a sub function
Where do I decalre the PUBLIC varibles
I tried to following in one of the modules (a_publicStuff):
Public NextTime As Double 'to setup 15 minute time
Public Const cRunIntervalSeconds = 900 ' 15 minutes
Public Const cRunWhat = "settimer_Click"
(if I put the above in my usercode area, the last two turn red)
and the following is in my userform code area.
Sub StartTimer()
'RunWhen = NextTime
Application.OnTime earliesttime:=NextTime, procedure:=cRunWhat, _
schedule:=True
End Sub
Sub settimer_Click()
MsgBox Format(Application.RoundUp(Time * 96, 0) / 96, "hh:mm:ss")
NextTime = NextTime + cRunIntervalSeconds
MsgBox cRunIntervalSeconds
MsgBox Format(NextTime, "hh:mm:ss")
End Sub
When I run my form, I get an error saying the macro can not be found.
If I create a macro with the name, it functions, but the nexttime does not
get incremented, and cRunIntervalSeconds is 0:00
Thanks
Bruce