API-Timer Problem
18.11.2006 23:41:33
Lars
was ist hier faul, beim Beenden stürzt Excel ab, Code steht in einem Standardmodul:
Option Explicit
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Dim Awnd As Long, bolOldStat As Boolean
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Application.StatusBar = Format(Time, "hh:mm:ss")
End Sub
Sub start()
Awnd = Application.hwnd
bolOldStat = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = Format(Time, "hh:mm:ss")
SetTimer Awnd, 0, 1000, AddressOf TimerProc
End Sub
Sub stopp()
KillTimer Awnd, 0
Application.DisplayStatusBar = bolOldStat
End Sub
mfg Lars