habe noch eine frage vor dem Wochenende.
Bitte um Hilfe.
ich teste gerade eine Timer funktion und mir ist ein fehler aufgefallen.
Kann mir jemand sagen warum ?
Ich starte den Timer(siehe code unten) und egal was ich mache ob ich mit der Maus in eine Zelle klicke oder in irendeine zelle einen Wert eingeben will schießt es mir mein Excel ab und beendet es.
Warum ?
Danke schon wie immer im vorraus für eure Hilfe !
Hier der code.
Option Explicit
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Long
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" ( _
ByVal hWnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Private Declare Function EnumChildWindows Lib "user32.dll" ( _
ByVal hWndParent As Long, _
ByVal lpEnumFunc As Long, _
ByVal lParam As Long) As Long
Private Declare Function KillTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private Declare Function SetTimer Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Const GC_CLASSNAMEMSEXCEL = "XLMAIN"
Private Const WM_GETTEXTLENGTH As Long = &HE
Private Const WM_GETTEXT As Long = &HD
Private hWnd As Long, lngConter As Long
Private strButtonCaption As String
Public Sub prcStartTimer()
SetTimer hWnd, 0&, 200&, AddressOf prcTimer
End Sub
Private Sub prcStopTimer()
KillTimer hWnd, 0&
End Sub
Private Sub prcTimer(ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal _
lpTimerFunc As Long)
If Cells(1, 1) = "ok" Then
KillTimer hWnd, 0&
Else
Cells(1, 1) = Time
End If
End Sub
'gruß Chris