Create a Word Macro to Save, Close, and Reset Forms
Question details
Create a Word macro that saves completed forms with sequential filenames, closes them, and opens a clean form without overwriting the template.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Users complete successive forms created from a reusable Word template.
- Observed behavior
- Each completed form should be saved separately, while the original template remains unchanged and a blank form opens for the next user.
Use desktop Word and prepare an empty form with the fields and formatting you need. Enable macros only for a template you trust, and choose a folder where completed forms can be saved.
Save the form as a template and add a save-and-reset macro
Use a macro-enabled template to create separate forms and automatically save, close, and replace each completed form.
The sample below is for desktop Word on Windows and a single user. It finds the first available filename in the selected folder; it does not maintain a permanent counter or coordinate simultaneous users.
The completed form is saved as a .docx file. Keep the macro in the .dotm template, not in the completed document.
Open the blank form in Word, select File > Save As, and choose Word Macro-Enabled Template (*.dotm). Save it with a distinctive name.
Open the .dotm template for editing. Select Developer > Visual Basic, use Insert > Module in the template project, and paste this code: Sub SaveCloseAndResetForm() Dim completed As Document Dim fresh As Document Dim folder As String Dim fileName As String Dim templatePath As String Dim n As Long Set completed = ActiveDocument templatePath = ThisDocument.FullName With Application.FileDialog(msoFileDialogFolderPicker) .Title = "Choose a folder for completed forms" If .Show <> -1 Then Exit Sub folder = .SelectedItems(1) End With If Right$(folder, 1) <> "\" Then folder = folder & "\" n = 1 Do fileName = folder & "Form_" & Format$(n, "0000") & ".docx" If Dir$(fileName) = "" Then Exit Do n = n + 1 Loop completed.SaveAs2 FileName:=fileName, FileFormat:=wdFormatXMLDocument Set fresh = Documents.Add(Template:=templatePath, NewTemplate:=False) completed.Close SaveChanges:=wdDoNotSaveChanges fresh.Activate End Sub
Save the .dotm template, then double-click it in File Explorer to create a new document. Complete a test form and select Developer > Macros > SaveCloseAndResetForm > Run.
Choose the completed-forms folder when prompted. Confirm that a file such as Form_0001.docx appears there, the completed form closes, and a new blank form opens.

Use a Word template and save each form manually
Use this approach if you do not need automation or cannot enable macros.
Create and edit forms with WPS Writer
WPS Office is a free, lightweight Office alternative with a familiar interface for creating and editing forms. It supports common Word formats, making it easier to move existing documents into WPS Writer. The Word VBA macro on this page is not a fix for WPS and may require a different approach there.

Frequently Asked Questions
Should my Word form template be a DOTM or DOTX file?
Choose Word Macro-Enabled Template (*.dotm) under File > Save As if the template contains the macro. Use Word Template (*.dotx) if it has no macros.
Will creating a document from the template overwrite the blank form?
No. Double-clicking the template or selecting it through File > New creates a separate document. Save that document with its own filename rather than editing and saving the template itself.
Why does the sample macro start its numbering at an earlier number?
The macro checks for existing Form_0001.docx-style filenames in the selected folder and uses the first available number. If an earlier file was deleted or moved, that number can be reused.
Can several users run the sample macro in the same folder?
They should not run it simultaneously against a shared folder. The filename check is not locked, so users could select the same name. Use a coordinated counter with locking for a shared sequence.
How do I find the Developer tab in Word?
In Word for Windows, select File > Options > Customize Ribbon, check Developer, and select OK. Then use Developer > Visual Basic to edit the template macro.




