VBA - Now Function


Advertisements

The Function Now returns the current system date and time.

Syntax

Now()

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   Dim a as Variant
   a = Now()
   msgbox("The Value of a : " & a)
End Sub

When you execute the above function, it produces the following output.

The Value of a : 19/07/2013 3:04:09 PM 
vba_date_time.htm
Advertisements