How to Create a Word File Name from the First Paragraph and Date Field
Question details
The user wants to generate a complete file name using the exact text from the document's first paragraph and a formatted date field, bypassing default truncation.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Attempting to automatically save a Word document using its initial paragraph text and a date field as the default file name.
- Observed behavior
- Word's default 'Save As' suggestion automatically truncates the file name at the first punctuation mark and completely omits dynamic field results like dates.
Before proceeding, note that Windows has strict file naming conventions. Ensure your intended file name does not contain prohibited characters such as colons, slashes, or asterisks.
Use a VBA Macro to Build the Complete File Name
Since Word's built-in feature applies its own truncation rules, using a VBA macro is the most effective way to extract the full paragraph and date field.
A paragraph in Word is defined as text ending with a paragraph mark. While punctuation marks do not technically end a paragraph, Word's automatic file-name feature will stop reading at the first punctuation mark it encounters. To capture the full string including fields and punctuation, you must utilize a VBA script.
Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications editor in Microsoft Word.
In the left-hand Project pane, right-click your document name, select 'Insert', and click 'Module'.
Paste a custom VBA script designed to read 'ActiveDocument.Paragraphs(1).Range.Text', format the date field, and strip out any illegal Windows file name characters.
Press 'F5' or click the 'Run' button to execute the script, which will prompt the 'Save As' dialog populated with your fully formatted file name.

Try WPS Office for Seamless Document Editing
If you are frustrated with Microsoft Word's default rules and limitations, consider switching to WPS Office. It provides a highly compatible, free, and lightweight alternative for all your document processing needs.
- 1. Download WPS Office: Visit the official WPS website to download the free installation package.
- 2. Install the Software: Run the installer and follow the simple on-screen instructions to set up the software.
- 3. Open Your Documents: Launch WPS Writer and open your existing Word documents seamlessly without losing formatting.

Frequently Asked Questions
Why does Word stop suggesting the file name at the first comma or period?
By design, Word's automatic 'Save As' suggestion extracts text up to the very first punctuation mark it encounters in the first paragraph. To capture text beyond the punctuation, manual input or a macro is required.
What characters are illegal in Windows file names?
Windows restricts certain characters in file names, including backslashes (\), forward slashes (/), colons (:), asterisks (*), question marks (?), quotation marks ("), and angle brackets (< >). You cannot use these regardless of the software.
Will the date field automatically update in the file name later?
No. Once the document is saved, the file name becomes static. If the date field inside the document updates tomorrow, the file name will remain the same unless you manually rename it or run the macro again to save a new copy.




