SRet = Format(tSystem.Milliseconds, “000”) Public Function GetMyMilSeconds() As String Now that you have declared GetSystemTime you can use it in a VBA function: VBA Milliseconds Function Private Declare Sub GetSystemTime Lib “kernel32” (lpSystemTime As SYSTEMTIME) Now, declare a function that references the the Windows API kernal32 In the top of the module type in the private type. How does one get the system time using windows api call to the Windows API kernal32? You can use it in your own vba module to obtain system time milliseconds (which I have used for randomization purposes).Īlthough VBA has ways of getting this information too, you might want to ‘go outside’ of VBA to get the milliseconds and system time directly from the windows operating system. In the following example GetSystemTime is used. One could create a private type of “SYSTEMTIME” to use with an API call to obtain the system time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |