1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Public Declare Function GetTickCount& Lib "kernel32" ()
Private Sub CommandButton1_Click()
Dim Départ As Double, arrivée As Double, Durée As Double, i As Long
Dim mn As Integer, ms As Integer, sd As Integer, tps As String
Départ = GetTickCount&
'************* ton code ********************
For i = 1 To 100000 'remplace le déroulement du code
DoEvents
Next
'*****************************************
arrivée = GetTickCount&
Durée = arrivée - Départ
mn = Int(Durée / 1000 / 60)
sd = Int((Durée / 1000) - (mn * 60))
ms = Durée - (sd * 1000) - (mn * 1000 * 60)
'Formatage #:##:###
tps = mn & ":" & Right("00" & sd, 2) & ":" & Right("000" & ms, 3)
MsgBox tps
End Sub |
Partager