Insert an Updating Date Field from a Word UserForm
Question details
Insert a Word date field from a VBA UserForm instead of inserting the current date as plain text.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- A UserForm supplies information to a Word document and must place an updating date at a predefined location.
- Observed behavior
- The desired result is a DATE field that can refresh to the current date, rather than a fixed text value.
Open the document or template in Word and identify where the date should appear. Save it as a macro-enabled file, and enable macros only if you trust the code and its source.
Add a DATE field at a bookmark from the UserForm
Use a bookmark to insert the field at a predictable location when the user clicks a UserForm button.
The VBA Now function returns a date and time value; inserting that value as text does not create an updating Word field. Fields.Add inserts a DATE field that Word can update.
Place the cursor where the date should appear, select Insert > Bookmark, enter DateLocation as the bookmark name, and click Add.
Open Developer > Visual Basic, find the UserForm in the project, and open the code for its command button.
In the button's Click event, use this code. If the button has a different name, use its existing Click procedure name instead: Private Sub CommandButton1_Click() Dim dateRange As Word.Range Dim dateField As Word.Field If Not ActiveDocument.Bookmarks.Exists("DateLocation") Then MsgBox "The DateLocation bookmark was not found." Exit Sub End If Set dateRange = ActiveDocument.Bookmarks("DateLocation").Range dateRange.Collapse Direction:=wdCollapseStart Set dateField = ActiveDocument.Fields.Add( _ Range:=dateRange, Type:=wdFieldDate, _ Text:="\@ ""dddd, MMMM d, yyyy""", _ PreserveFormatting:=False) dateField.Update End Sub
Run the UserForm in Word and click the command button. Confirm that the formatted date appears at the DateLocation bookmark.

Edit Word documents with WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface and support for Microsoft Word formats, making it easy to move everyday document editing to WPS Writer. The Word-specific UserForm VBA solution above should be run and tested in Microsoft Word.

Frequently Asked Questions
Why doesn't inserting Now create an updating date?
VBA's Now function returns a date and time value. If you insert that value as text, it stays as text; use Word's Fields.Add method with wdFieldDate to create a DATE field.
How can I update the date field manually?
In Word, right-click the date field and select Update Field. You can also select the field and press F9.
What is the difference between DATE and CREATEDATE?
A DATE field displays the current date when updated. A CREATEDATE field displays the document's creation date, so it is useful when that date should remain fixed.
What if the bookmark is missing?
Create it with Insert > Bookmark and name it DateLocation, or change the bookmark name in both places in the code to match an existing bookmark.




