I’ve described a Word VBA macro that closes all files.
Actually, we can close all files without looping.
Sub ClosingAllFilesWithoutLoop() Documents.Close End Sub
We need only the following code:
The Application.Documents property returns the Documents collection object.
The Documents property is a member of the Word.Global class, so we can omit the Application property.
The Documents is a collection of all the Document objects those are currently open in Word.
The Documents collection object has the Close method.
And this Documents.Close method allows us to close all files without looping.
- Word 2013
- Word 2010
- Word 2007