Working with Microsoft Word Objects

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

In Microsoft® Word, the fundamental working object is a document and everything is part of the document. When you are using VBA to work with Word, a Document object represents an open document, and all Document objects are contained in the Application object's Documents collection. Because each Document object is based on a template, each document has an AttachedTemplate property.

A document is a collection of characters arranged into words, words are arranged into sentences, sentences are arranged into paragraphs, and so on. Therefore, each Document object has a Characters collection, a Words collection, a Sentences collection, and a Paragraphs collection. Furthermore, each document has a Sections collection of one or more sections, and each section has a HeadersFooters collection that contains the headers and footers for the section. In addition, some or all of the text in the document might have certain formatting attributes set, and paragraphs might have built-in or custom styles applied.

In This Section