How to Automatically Update Weekly Dates in Word Using VBA Macro
Question details
The user needs an efficient way to automatically update weekly date ranges (e.g., changing 2021 dates to 2022) across multiple Word documents without manual typing.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Updating annual forms where ordinary text is used to denote weekly date ranges (e.g., "Week of: January 10–14, 2021") across approximately 20 different documents.
- Observed behavior
- Manually editing the date ranges on every single page of 20+ documents is highly inefficient and prone to human error.
Always make a backup copy of your Word documents before running any VBA macros, as bulk text replacements made by scripts often cannot be easily undone.
Create and Run a Date-Updating VBA Macro
Use a custom VBA procedure with wildcard search capabilities to automate the discovery and recalculation of weekly date blocks.
A VBA procedure can search for specific date range structures, such as "Week of: January 11–15, 2021," extract the base month, and calculate the corresponding weekday dates for the target year (like 2022).
The script relies on wildcard expressions, so the search pattern must perfectly match your document's exact wording, dash characters (en-dash vs. hyphen), and spacing.
Launch your Word document and press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor window.
In the top menu bar, click on 'Insert' and select 'Module' from the dropdown. This will open a blank code window on the right side of the screen.
Paste your custom VBA code into the module window. The code should include a Wildcard Find sequence (like .Text = "Week of: [!,]{1,}, 2021") and a date conversion function.
Press F5 or click the green 'Run' button at the top of the editor. If prompted, select the backup copy of your file from the dialog box to apply the automated updates.
Try WPS Office for Seamless Word Document Management
While complex VBA macro issues are specific to your current Office environment, WPS Office offers a lightweight, highly compatible, and free alternative. WPS Writer includes powerful advanced Find and Replace functions with full wildcard support, helping you manage bulk text updates intuitively.
- 1. Download the Installer: Visit the official WPS website and download the free installer for your operating system.
- 2. Install WPS Office: Run the setup file and follow the on-screen prompts to install the suite on your device in minutes.
- 3. Open Your Documents: Launch WPS Writer and open your existing Word forms to continue editing them with seamless compatibility.

Frequently Asked Questions
Why is my VBA macro not replacing any dates?
The macro's wildcard search pattern must perfectly match your document's text. If your document uses an en-dash (–) but the script looks for a standard hyphen (-), or if there are non-breaking spaces, the macro will not recognize the text.
Can I update these dates using Word's built-in Find and Replace?
You can use Word's 'Find and Replace' feature with the 'Use wildcards' option checked to locate the old dates. However, automatically calculating the exact new calendar days (like shifting January 11 to January 10 for the new year) requires either a macro or manual input.
How do I save a document that contains my new VBA macro?
If you want to keep the macro for future use, you must save the document as a Word Macro-Enabled Document (*.docm). Standard .docx files will not save the VBA code upon closing.




