The Document Object
Each open Word document is represented by a Document object. There are two ways to get a Document object: create a new one or open an existing one. Once you are done working with the document, the object must be saved (at least in most cases) and then closed. Let's look at these tasks first, then we will examine the many tools available for manipulating document content.
Opening and Creating Documents
To create a new document, use the Documents collection's Add method. The syntax is
Dim MyDoc As Word.Document Set MyDoc = Documents.Add(Template, NewTemplate)
The Template argument specifies the name of the template that the new document is to be based on. The NewTemplate argument specifies whether the new document is a document ...
Get Office® XP Development with VBA now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.