The VBA TIME Function

Related Functions:
VBA Date
VBA Now

Description

The VBA Time Function simply returns the current time. The function takes no parameters and therefore, its syntax is:

Time( )

VBA Time Function Example

A simple example of the VBA Time function is shown below:

' Store the current time in the variable currTime
Dim currTime As Date
currTime = Time()

After running the above VBA code, the variable currTime is set to the current time.

(Note that in VBA, times are stored as a part of the 'Date' data type).