Word Macro: Saving All Files Without Looping

I’ve described a Word VBA macro that saves all files.
Actually, we can save all files without looping.
Here is the macro.

Macro Example

Sub SavingAllFilesWithoutLoop()
 
  Documents.Save NoPrompt:=True

End Sub

Description

We need only the following code:

  Documents.Save NoPrompt:=True

That’s all.

The Application.Documents property returns the Documents collection object.

obj-Word-Application-Documents

The Documents property is a member of the Word.Global class, so we can omit the Application property.

obj-Word-Documents

The Documents is a collection of all the Document objects those are currently open in Word.

obj-Word-Documents

The Documents collection object has the Save method.

obj-Word-Documents-Save

This Documents.Save method allows us to save all files without looping.
And we are providing the NoPrompt parameter, NoPrompt:=True.

  Documents.Save NoPrompt:=True

This defines to save all documents automatically.

If there are unsaved files, those are ignored.

Properties

http://www.relief.jp/itnote/archives/word-vba-save-all-files.php

Apply To

  • Word 2013
  • Word 2010
  • Word 2007