Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried using Chip's Win API code at...
(Using Windows Timers) http://www.cpearson.com/excel/ontime.htm It ran fine, except when I was in the Edit mode. Without fail, it shuts down Excel with no dialog box or other warning. On restart, it shows the file as been recovered from a crash. ?? What am I doing wrong? Is there a library to reference? I couldn't find one. Windows 2000 5.002195 SP3 Excel 2002 SP1 TIA, and here's the 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 = 5 ' 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) ' ' The procedure is called by Windows. Put your ' timer-related code here. ' Range("a1").Value = Now() End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Timer in Excel | Excel Discussion (Misc queries) | |||
i want all windows in one excel frame (windows in taskbar) | Excel Discussion (Misc queries) | |||
Windows Explorer hangs then crashes. | Excel Discussion (Misc queries) | |||
Stopping a Timer / Running a timer simultaneously on Excel | Excel Discussion (Misc queries) | |||
Excel VBA - Timer | Excel Programming |