20.2. Working with the Documents Collection and the Document Object

In many of your Word procedures, you'll work with documents: creating new documents, saving documents, opening existing documents, closing documents, and printing documents. To do so, you work with the Documents collection, which contains a Document object for each open document in Word.

20.2.1. Creating a Document

To create a new file, use the Add method of the Documents collection. The syntax is as follows:

expression .Add Template, NewTemplate, DocumentType, Visible

Here, expression is a required expression that returns a Documents collection. Typically, you'll want to use the Documents collection itself.

Template is an optional Variant argument that specifies the template ...

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.