How to Automatically Enter Related Dates in a Word Newsletter
Question details
The user needs a method to populate several related dates in a Word newsletter automatically based on a single input date.

- Product
- Microsoft Word / WPS Writer
- Device & OS
- not provided
- Scenario
- Creating a recurring newsletter where multiple dates (e.g., Next Monday, Last Tuesday) need to be calculated and inserted automatically from one base date.
- Observed behavior
- The goal is to eliminate manual date entry and use automated document variables or calculated fields to pull related dates dynamically.
Ensure that the Developer tab is enabled in your word processor to access the VBA editor, and remember to save your document as a macro-enabled format (.docm).
Automate Related Dates using DOCVARIABLE Fields and VBA
This is the most efficient method if you are comfortable with running macros. It uses an InputBox to prompt for a base date and calculates the rest automatically.
By utilizing Word's DOCVARIABLE fields paired with a simple VBA macro, you can calculate multiple dates relative to an inputted date and populate them instantly throughout the document.
In your Word document, press Ctrl+F9 to insert a blank field bracket. Type 'DOCVARIABLE NextMonday' inside the brackets. Repeat this for other dates like NextTuesday, LastTuesday, and LastThursday.
Press Alt+F11 to open the Visual Basic for Applications (VBA) editor. Go to Insert > Module to create a new macro module.
Write a subroutine that uses an InputBox to ask the user for the base date. Use the DateAdd function to calculate the offset for NextMonday, NextTuesday, etc., based on the entered date.
In the same macro, assign the calculated dates to your document variables using the syntax: ActiveDocument.Variables("NextMonday").Value = calculatedDate.
Finish the macro by adding the command 'ActiveDocument.Range.Fields.Update' so that all the DOCVARIABLE fields display the newly calculated dates automatically when the macro runs.

Use Excel Date Formulas and Mail Merge
If your environment restricts macros or you prefer a code-free approach, you can calculate the dates in Excel and use Mail Merge to insert them into your Word document.
Automate Document Workflows Easily with WPS Writer
WPS Writer fully supports DOCVARIABLE fields and provides an advanced VBA editor to automate repetitive tasks like date calculation in your newsletters seamlessly.
- 1. Open WPS Writer: Launch WPS Office and open your newsletter template document.
- 2. Insert Variables: Navigate to the Insert tab, select Field, and choose DOCVARIABLE to place your date placeholders.
- 3. Access the Developer Tools: Switch to the Developer tab to locate macro security settings and the VBA editor.
- 4. Run your Macro: Click the Macros button to run your date-calculation script and instantly update the newsletter.

Frequently Asked Questions
Can I calculate dates in Word fields without using VBA?
Yes, but it requires writing complex nested IF statements and date formatting fields. For advanced users, searching for the 'Microsoft Word Date Calculation Tutorial' by MVP Paul Edstein provides a comprehensive guide to field-based calculations.
Why aren't my DOCVARIABLE fields updating after I run my macro?
Word fields don't always refresh automatically. Ensure your macro includes the line 'ActiveDocument.Range.Fields.Update'. Alternatively, you can select the entire document (Ctrl + A) and press F9 to force a manual update.
Is it safer to use Mail Merge instead of macros for newsletters?
If your organization disables macros for security reasons, using Mail Merge connected to an Excel sheet containing date formulas is the safest and most reliable code-free alternative.




