The Range Property

Many Word objects have a Range property that returns a Range object, including the Paragraph and Selection objects (discussed later). This is important because these objects lack certain properties and methods that are handy for manipulating text. For example, the Paragraph object doesn't have an Italic property. The Range object does, however, so you format a paragraph's font as italic programmatically by referring to its Range property, like so:

ActiveDocument.Paragraphs(1).Range.Italic = True

This statement formats the first paragraph in the active document with italic text. (I discuss the Paragraphs collection in a moment.)

0 0

Post a comment