Hi Telperion,
It's difficult to solve your entire problem, without seeing all the code.
What's problematic is changing the remaining time on the fly
I'm assuming you change the time on the fly by calling 'btnStartSnakeTimer_Click'.
Try the following to change the time on the fly:
a. Add a global time variable
b. Change the way you schedule the timer to use the global time variable
myTime = Now + TimeSerial(0, 0, 1)
Application.OnTime myTime, "RunSnakeTimer"
c. When you change the code on the fly (in btnStartSnakeTimer_Click()') , first stop the timer (if it is running) using the global scheduled time. A runtime error will be generated if the timer is NOT running, hence the need for 'On Error Resume Next'. Then you can start the timer again.
Code snippet out of context:
'Stop the timer (if it is running)
On Error Resume Next
Application.OnTime EarliestTime:=myTime, Procedure:="RunSnakeTimer", Schedule:=False
On Error GoTo 0
'Restart the timer
nTime = nCountSnake
TimerCode.RunSnakeTimer
Lewis
Bookmarks