S
Seth
I am using the API timer functions to emulate the VB
timer capability in an Excel project (see following code):
--------------------------------------------------------
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&,
AddressOf 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)
' My code here
End Sub
--------------------------------------------------------
OK, so everything works well until I call the EndTimer
function (I call this function when I terminate a
userform). I go back to the Excel interface but I can't
use the mouse to click on anything (cells, toolbars,
etc.).
Anybody know what is going on here?
Thanks,
Seth
timer capability in an Excel project (see following code):
--------------------------------------------------------
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&,
AddressOf 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)
' My code here
End Sub
--------------------------------------------------------
OK, so everything works well until I call the EndTimer
function (I call this function when I terminate a
userform). I go back to the Excel interface but I can't
use the mouse to click on anything (cells, toolbars,
etc.).
Anybody know what is going on here?
Thanks,
Seth