Is there a way to use VBA (excel) to generate a clock time with accuracy to a tenth of a second or less?
eg:
Sub test()
MsgBox Format(Time, \"hh:
You can use the Windows API to get a more accurate time (including milliseconds) as follows.
Private Type SYSTEMTIME
Year As Integer
Month As Integer
DayOfWeek As Integer
Day As Integer
Hour As Integer
Minute As Integer
Second As Integer
Milliseconds As Integer
End Type
Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Public Function GetMilliseconds()
'' This function returns an accurate version of the milliseconds elememt of the current date/time
Dim tSystem As SYSTEMTIME
GetSystemTime tSystem
GetMilliseconds = tSystem.Milliseconds
End Function
Credit goes to http://custom-designed-databases.com/wordpress/2011/get-milliseconds-or-seconds-from-system-time-with-vba/ where there is also more detailed information on getting the milliseconds from the system time in VBA.