' Declare the Windows call to retrieve the time in milliseconds
Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
Dim t1 As Long, t2 As Long
Debug.Print "Time = " & (t2-t1)
Sub TimeTest() Dim startTime As Date Dim endTime As Date Dim diffTime As Date
' Wait some duration startTime = Time ' Record starting time Wait(5) ' Your processing here... endTime = Time ' Record end time
' Find the difference between the two diffTime = endTime - startTime
' In "Date" variables the whole value gives the date, while the fraction ' is the time of day. Here the difference is scaled by 24 hours, ' 60 minutes, and 60 seconds to obtain the difference in seconds. Debug.Print CDbl(diffTime) * 24*60*60; " seconds."