Returns the current system time (Date).

* When used in the editor, brackets are not automatically removed.
* This function should be prefixed with "VBA." to make it easier to understand.
* You can use the DATE function to return the current system date.
* You can use the NOW function to return the current system date and time.
* You can use the TIME Statement statement to set the current system time.
* You can use the TIME$ function to return a String data type instead of a Variant data type.
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print VBA.Time()    '= volatile  
Debug.Print VBA.Time() '= "12:49:31"

Dim sngSerial As Single
sngSerial = VBA.Time()
Debug.Print sngSerial '= 0.5340278

Dim sTime As String
sTime = VBA.Time()
Debug.Print sTime '= "12:49:31"

Dim dtTime As Date
dtTime = VBA.Time()
Debug.Print dtTime '= "12:49:31"

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top