Share via


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 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 may have certain formatting attributes set, and paragraphs may have built-in or custom styles applied.

Note   You can view the entire Word object model in the . You can also use the Object Browser and Microsoft Word Visual Basic Reference Help to learn more about individual objects, properties, methods, and events. For more information about using VBA to work with an Office application's object model, see Chapter 4, "Understanding Office Objects and Object Models."