1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| Option Explicit
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 CelluleCourante As Range
'========== Déclarations Public ========================
Public TimerID As Long 'Activer avec cet ID
Public TimerActive As Boolean 'Est le minuteur actif
'=======================================================
Public Sub ActiverTimer(ByVal sec As Long)
sec = sec * 1000
If TimerActive Then Call DesactiverTimer
On Error Resume Next
TimerID = SetTimer(0, 0, sec, AddressOf Timer_CallBackFunction)
TimerActive = True
End Sub
Public Sub DesactiverTimer()
KillTimer 0, TimerID
End Sub
Public Sub Timer_CallBackFunction(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idevent As Long, _
ByVal Systime As Long)
Dim vel
'Affichage sur le Userform
Pageaccueil.Labeldate.Caption = Format(Now, "dddd dd mmmm yyyy") 'ou "Long Date"
Pageaccueil.LabelFdj.Caption = Format(Now, "hh:mm") 'ou "Long Time"
End Sub |
Partager