How to Set Word Template to Auto-Insert Current Date as Plain Text
🔍 WiseChecker

How to Set Word Template to Auto-Insert Current Date as Plain Text

You want every new document based on a Word template to start with the current date already inserted, and you need that date to be plain text so it does not update later. By default, Word uses a date field that refreshes each time the document opens. This causes problems when the date must remain fixed, such as in legal forms, invoices, or dated correspondence. This article explains how to create a template that inserts today’s date as static text using a macro and the Document_New event.

Key Takeaways: Auto-Insert Current Date as Plain Text in a Word Template

  • AutoOpen and Document_New macros: Run code automatically when a document is created or opened from a template.
  • Date function and Format function: Insert the current system date as plain text with a specified format.
  • Save as .dotm (macro-enabled template): Required to store and run VBA macros in a template file.

ADVERTISEMENT

How Word Inserts Dates by Default and Why That Matters

When you use the Insert > Date and Time command in Word and check “Update automatically,” Word inserts a DATE field. This field displays the current date based on your system clock. Every time you open the document, Word refreshes the field to show the current date, not the date when the document was created. This is the correct behavior for a dynamic date field, but it is the opposite of what you need for a fixed date.

If you uncheck “Update automatically,” Word inserts the date as plain text at that moment. But when you save the file as a template, the plain text date is locked to the date you created the template. Every new document based on that template would show that same old date. To insert the current day’s date as plain text each time a new document is created, you must use a VBA macro that runs when the new document is generated.

What the Document_New Event Does

Word templates can contain VBA code that runs automatically in response to events. The Document_New event fires when a new document is created from a template. This event is the correct place to insert the date. The macro can use VBA’s Date function to retrieve the system date and the Format function to control how the date appears. Because the macro writes the date as a string, it is static text — not a field — so it will never update.

Steps to Create a Template That Auto-Inserts Today’s Date as Plain Text

Follow these steps to build a macro-enabled template (.dotm) that inserts the current date as plain text at the top of every new document.

  1. Enable the Developer Tab in Word
    Open Word. Go to File > Options > Customize Ribbon. In the right pane, check the box next to Developer. Click OK. The Developer tab now appears on the ribbon.
  2. Create a New Blank Document
    Press Ctrl+N to create a new blank document. This document will become the basis for your template.
  3. Open the VBA Editor
    On the Developer tab, click Visual Basic. Alternatively, press Alt+F11. The VBA editor opens in a separate window.
  4. Insert a Module for the Template Project
    In the VBA editor, look at the Project Explorer pane on the left. If you do not see it, click View > Project Explorer. Find the project named “Normal” or “Project (Document1).” Right-click “ThisDocument” under the project. Choose View Code. A blank code window opens.
  5. Write the Document_New Macro
    In the code window, paste the following VBA code:
    Private Sub Document_New()
        Dim dt As String
        dt = Format(Date, "mmmm d, yyyy")
        Selection.TypeText dt
    End Sub

    This code runs when a new document is created from the template. It gets the system date, formats it as “January 1, 2025,” and types that text at the cursor position. To use a different format, replace "mmmm d, yyyy" with one of these: "d MMMM yyyy" for “1 January 2025,” "MM/dd/yyyy" for “01/01/2025,” or "dd-MMM-yy" for “01-Jan-25.”

  6. Close the VBA Editor
    Click File > Close and Return to Microsoft Word in the VBA editor menu bar. You return to your document.
  7. Design the Template Content
    In the document, add any other content that should appear in every new document: letterhead, boilerplate text, tables, or placeholders. Place the cursor exactly where you want the date to appear. The macro inserts the date at the cursor position when the document is created, so position the cursor accordingly before saving the template.
  8. Save the File as a Macro-Enabled Template
    Click File > Save As. Choose a location, such as your custom Office Templates folder. In the Save as type dropdown, select “Word Macro-Enabled Template (dotm).” Enter a name for your template, for example “InvoiceTemplate.dotm”. Click Save. Word saves the file as a template with the .dotm extension, which preserves the VBA macro.
  9. Test the Template
    Close all Word windows. Open Word again. Click File > New. Click Personal or Shared (depending on your Word version). Find your template and click it. Word creates a new document. The current date should appear as plain text at the top. Verify that the date is not a field by right-clicking it — if “Update Field” does not appear in the context menu, the date is static text.

ADVERTISEMENT

If the Date Does Not Appear or the Macro Does Not Run

Several settings can prevent the macro from executing. Check each of the following scenarios.

The Template Was Saved as .dotx Instead of .dotm

A .dotx file cannot contain macros. If you saved the template as .dotx, Word ignores any VBA code in the file. Open the template, click File > Save As, and choose “Word Macro-Enabled Template (dotm).” Overwrite the existing file.

Macro Security Settings Block the Code

Word disables macros by default if the file is from an untrusted location. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Select “Enable all macros” only for testing. For production use, store the template in a trusted location: go to File > Options > Trust Center > Trust Center Settings > Trusted Locations, add the folder where you saved the .dotm file, and select “Subfolders of this location are also trusted.” Then set Macro Settings back to “Disable all macros except digitally signed macros” or “Disable all macros with notification.”

The Macro Was Placed in the Wrong Module

The Document_New event must be in the ThisDocument code module of the template project, not in a standard module or in the Normal.dotm project. Open the VBA editor, double-click “ThisDocument” under the template project, and verify the code is there. If you placed the code in a standard module (Module1), the event will not fire. Move the code to ThisDocument.

Comparison: Date Insertion Methods in Word Templates

Item Insert > Date with “Update automatically” checked Insert > Date with “Update automatically” unchecked VBA macro using Document_New
Result type DATE field (dynamic) Plain text (static) Plain text (static)
Updates on open Yes No No
Template date behavior Shows current date at document creation, then updates on each open Shows the date the template was saved Shows the date the new document was created, never updates
File format required .dotx or .dotm .dotx or .dotm .dotm only
Macro security concern None None Must enable macros or use trusted location

You can now create a Word template that automatically inserts the current date as plain text every time a new document is generated. The VBA macro using the Document_New event gives you full control over the date format and ensures the date never updates. For additional automation, consider adding a macro that also inserts the time or the document author name using the same technique. A practical next step is to combine this date macro with a Quick Part or AutoText entry to build a complete document header.

ADVERTISEMENT