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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| 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
Dim TimerID As Long
Sub TestChrono()
UserForm1.Show
End Sub
Sub TimerOff()
KillTimer 0, TimerID
End Sub
Sub TimerOn(Interval As Long)
TimerID = SetTimer(0, 0, Interval, AddressOf Chrono)
End Sub
Sub Chrono()
Dim H, DS
On Error GoTo linerr
DS = CByte(UserForm1.Label2.Caption) + 1
UserForm1.Label2.Caption = CStr(DS)
If (DS Mod 1) = 0 Then
If UserForm1.Label1.Caption = "00:00:00" Then
H = TimeSerial(0, 0, 1)
Else
H = TimeValue(UserForm1.Label1.Caption) + TimeSerial(0, 0, 1)
End If
UserForm1.Label1.Caption = Format(H, "hh:mm:ss")
UserForm1.Label2.Caption = "0"
UserForm1.Label3.Caption = (10 - Second(H)) & " s"
If Second(H) < 11 Then
UserForm1.ProgressBar1.Value = Second(H)
Else
TimerOff
Unload UserForm1
connexion
End If
End If
Exit Sub
linerr:
TimerOff
MsgBox "Erreur du chrono"
End Sub
Sub test2()
MsgBox "Execution de la sub test"
End Sub
'Sub modifLOL()
' Dim objExplorer As Outlook.Explorer
' Dim objCommandBar As Office.CommandBar
' Dim objControl As Office.CommandBarButton
'
' 'On Error GoTo linerr
' Set objExplorer = Outlook.ActiveExplorer
' Set objCommandBar = objExplorer.CommandBars.item(25)
' Set objControl = objCommandBar.Controls.item(4)
'
' objControl.Caption = "LOL : " & Hour(Time) & ":" & Minute(Time)'
'
'linerr:'
'
'End Sub |
Partager