How to Save All Open Documents in Word Using a VBA Macro
Question details
The user wants to create a VBA macro to automatically save every open Word document in a single action, rather than saving them individually.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Managing multiple open documents and needing a bulk save action without repeatedly clicking save for each active window.
- Observed behavior
- Word's default save function only saves the currently active document. A VBA loop is required to iterate through and save the entire open Documents collection.
Before running the macro, ensure that you have enabled the Developer tab in Word and that your macro security settings are configured to allow VBA scripts to run.
Use a VBA Loop to Save All Open Documents (Skips Unsaved Files)
Create a macro that iterates through the Documents collection and saves each one, explicitly skipping brand-new, unnamed files to prevent the 'Save As' prompt from interrupting the automation.
This is the most efficient method for saving multiple documents you are already working on. By checking the document's file path, the macro intelligently ignores entirely new files that haven't been saved to your drive yet.
Open Word and press Alt + F11 on your keyboard to launch the Visual Basic for Applications (VBA) Editor.
In the VBA Editor, click on 'Insert' in the top menu bar, and then select 'Module' to create a blank script window.
Copy and paste the following code into the module window: Sub SaveAllOpenDocs() Dim D As Document For Each D In Documents If D.Path <> "" Then D.Save Next End Sub
Press F5 or click the 'Run' button (the green triangle) in the toolbar to execute the macro. All documents with an existing file path will be saved instantly.

Basic VBA Macro to Save Every Document (Includes Prompts)
Use this simpler macro if you want Word to intentionally prompt you to name and save any brand-new documents that haven't been given a file path yet.
Save Multiple Documents Effortlessly in WPS Writer
WPS Office Writer provides a seamless environment for managing multiple documents. Not only does it support advanced VBA macros for custom automation, but its tabbed interface allows you to easily manage, navigate, and save multiple open files within a single window.
- 1. Open Documents in Tabs: Open multiple documents in WPS Writer. Notice how they arrange neatly in tabs at the top, just like a web browser.
- 2. Access the Macro Editor: Press Alt + F11 to open the built-in WPS Macro Editor (available in versions with VBA support installed).
- 3. Run the Save Macro: Paste the VBA script provided in the solutions above to save all your open documents instantly.

Frequently Asked Questions
Why does my macro stop and ask for a file name?
If an open document has never been saved before, it does not have an established file path on your computer. The standard `D.Save` command triggers the 'Save As' dialog for these files. You can bypass this by adding an `If D.Path <> ""` check to your VBA loop.
Can I add a confirmation message when all documents are saved?
Yes, you can add `MsgBox "All documents saved!"` right before the `End Sub` line in your macro. This will display a pop-up alert once the entire saving process is complete.
How do I assign this macro to a quick access button?
In Word, go to File > Options > Quick Access Toolbar. Select 'Macros' from the 'Choose commands from' drop-down list, find your save macro in the list, and click 'Add' to place it on your toolbar for simple one-click access.
Will this macro automatically close the documents after saving them?
No, the provided VBA loop only executes the save command. The documents will remain open on your screen. If you want to close them simultaneously, you would need to add the `D.Close` command right after `D.Save` inside the loop.




