Microsoft Office 2000/Visual Basic Programmer's Guide |
Once you've got a document to work with, most of the tasks you'll want to perform with VBA will involve working with the text in the document or manipulating the objects contained in the document. Documents contain words, sentences, paragraphs, sections, headers and footers, tables, fields, controls, images, shapes, hyperlinks and more. All of these objects (and more) are available to you through VBA. This section will not cover all the objects a document exposes, just those that you are most likely to use on a regular basis.
The starting point for much of what you do to the contents of a document will be to specify a part of the document and then to do something to it. This may involve, for example, adding or removing text or formatting words or characters. The two objects you will use to accomplish much of this work are the Range object and the Selection object.