The VBA Now Function returns the current date and time. The function takes no parameters and therefore, its syntax is:
A simple example of the VBA Now function is shown below:
' Store the current date and time in the variable dateTime
Dim dateTime As DatedateTime = Now() |
After running the above VBA code, the variable dateTime is set to the current date and time.
(Note that in VBA, dates and times are stored as a part of the 'Date' data type).