Date & Time Stamp

Home Up Odds & Ends Photo Gallery Search Contact Me

 

 

The information in this website is provided without risk or obligation and free of charge.  However, if you have benefitted from my efforts here and would like to make a contribution to help me continue and maintain this work then any donation will be greatly appreciated. Please click the adjacent button to access PayPal.  Thank you.
 
There are several ways to enter the current date or time in a Word document.  Many users find the date autocomplete feature both frustrating and unreliable.  The menu sequence Insert>Date and Time offers an easy user interface, but the available formats are fixed and unless the user is careful to disable updating the results can be maddening.

Here is three examples of simple macros that can be assigned to a menu, toolbar icon, or keyboard shortcut  enabling you to quickly and accurately enter the current date, current time, or both as fixed text at the insertion point.

Sub DateStamp()
' Inserts current date
Selection.InsertDateTime DateTimeFormat:="MMMM dd, yyyy", InsertAsField:=False
End Sub

Stamp format displays -  March 19, 2005

Sub TimeStamp()
' Inserts current time
Selection.InsertDateTime DateTimeFormat:="HH:mm:ss", InsertAsField:=False
End Sub

Stamp format displays - 13:15:12 (24 hour military format)

Sub DateTimeStamp()
' Inserts current date
Selection.InsertDateTime DateTimeFormat:="MMMM dd, yyyy  hh:mm AM/PM", InsertAsField:=False
End Sub

Stamp format displays - March 19, 2005 09:15 AM

The macros in the above examples insert the date and time in a format I use most.  The format can be defined as any standard date and time format.  The following table list many available formats:

See:  Date Fields with Ordinals if you want to use a superscripted ordinal in your date stamp e.g., 19th March 2005.  Fellow MVP Graham Mayor has a complete explanation for doing this in his tips on special formats for Word fields. 

See: Installing Macros for instructions on how to set up and use the macros listed above.

See: Setup Menu/Toolbar for instructions on how to run a macro from a menu or toolbar icon.

See: Keyboard Shortcut for instructions on how to assign a macro to a keyboard shortcut.

See my Date Sequencer for a user friendly Word Add-in for inserting current, past, or future date and time entries in Word documents.


Looking for something else?

Google