Кто знает почему код в обычном модуле не работает в модуле класса
Код модуля:
Option Explicit
Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) _
As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, _
ByVal nIDEvent As Long) As Long
Private TimerId As Long
Function StartTimer(MyInterval As Long) As Long
TimerId = SetTimer(0&, 0&, MyInterval, AddressOf TimerProc)
End Function
Sub StopTimer()
Dim f As Long
f = KillTimer(0&, TimerId)
End Sub
Sub TimerProc(ByVal MyHwnd As Long, ByVal MyMsg As Long, ByVal TimerId As Long)
On Error GoTo err:
'код
Exit Sub
err:
StopTimer
End Sub
вызов функций производится из формы
точно такой же код в модуле класса выдает ошибку
"invalid use of AddressOf operator"