Share via


The Range Object

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.

A Range object represents a contiguous area in a document, defined by a starting character position and an ending character position. The contiguous area can be as small as the insertion point or as large as the entire document. It can also be, but does not have to be, the area represented by the current selection. You can define a Range object that represents a different area than the current selection. You can also define multiple Range objects in a single document. The characters in a Range object include nonprinting characters, such as spaces, carriage returns, and paragraph marks.

Note   The area represented by the current selection is contained in the Selection object.

A Range object is similar to a Word bookmark in that they both define a specific area within a document. However, unlike a bookmark, a Range object exists only so long as the code that creates it is running. In addition, when you insert text at the end of a range, Word automatically expands the range to include the new text. When you insert text at the end of a bookmark, Word does not expand the bookmark to include the new text.

See Also

Working with Microsoft Word Objects | Working with Document Content | Creating, Defining, and Redefining a Range | Working with Text in a Range Object | Determining Where the Range Is Located | Inserting Text in a Range | Understanding Paragraph Marks | The Selection Object | The Selection Object vs. the Range Object | Working with Bookmarks | The Find and Replacement Objects