S
SuitedAces
Please help me with this
I grabbed the following code from a website, it can be used as a timer
It works exactly as intended.
My question is which of the variables or procedure names need to b
changed to have two or more timers like this coexist in the sam
workbook.
I highlighted in bold what I am guessing needs to be changed.
*********************************************************
Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long) As Long
Public *TimerID* As Long
Public *TimerSeconds* As Single
Sub *StartTimer*()
*TimerSeconds* = 1 ' how often to "pop" the timer.
*TimerID* = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressO
*TimerProc*)
End Sub
Sub *EndTimer*()
On Error Resume Next
KillTimer 0&, *TimerID*
End Sub
Sub *TimerProc*(ByVal HWnd As Long, ByVal uMsg As Long, _
ByVal nIDEvent As Long, ByVal dwTimer As Long)
'
' The procedure is called by Windows. Put your
' timer-related code here.
'
End Sub
**********************************************************
Here are some comments that were included with the code from th
website.
The procedure TimerProc will be called by Windows every time the time
pops. You can name this procedure anything you want, but you mus
declare the argument variables exactly as shown in the example. If yo
change the name of the procedure, be sure to change the name in th
call to SetTimer as well.
nIDEvent The value returned by SetTimer to the TimerID variable. I
you have made more than one call to SetTimer, you can examine th
nIDEvent argument to determine which call SetTimer to resulted in th
procedure being called.
*THANK YOU FOR YOUR HELP
I grabbed the following code from a website, it can be used as a timer
It works exactly as intended.
My question is which of the variables or procedure names need to b
changed to have two or more timers like this coexist in the sam
workbook.
I highlighted in bold what I am guessing needs to be changed.
*********************************************************
Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long) As Long
Public *TimerID* As Long
Public *TimerSeconds* As Single
Sub *StartTimer*()
*TimerSeconds* = 1 ' how often to "pop" the timer.
*TimerID* = SetTimer(0&, 0&, TimerSeconds * 1000&, AddressO
*TimerProc*)
End Sub
Sub *EndTimer*()
On Error Resume Next
KillTimer 0&, *TimerID*
End Sub
Sub *TimerProc*(ByVal HWnd As Long, ByVal uMsg As Long, _
ByVal nIDEvent As Long, ByVal dwTimer As Long)
'
' The procedure is called by Windows. Put your
' timer-related code here.
'
End Sub
**********************************************************
Here are some comments that were included with the code from th
website.
The procedure TimerProc will be called by Windows every time the time
pops. You can name this procedure anything you want, but you mus
declare the argument variables exactly as shown in the example. If yo
change the name of the procedure, be sure to change the name in th
call to SetTimer as well.
nIDEvent The value returned by SetTimer to the TimerID variable. I
you have made more than one call to SetTimer, you can examine th
nIDEvent argument to determine which call SetTimer to resulted in th
procedure being called.
*THANK YOU FOR YOUR HELP