Range Object
Description
Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position. Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a document. However, unlike a bookmark, a Range object only exists while the procedure that defined it is running.
Note Range objects are independent of the selection. That is, you can define and manipulate a range without changing the selection. You can also define multiple ranges in a document, while there can be only one selection per pane.
Using the Range Object
Use the Range method to return a Range object defined by the given starting and ending character positions. The following example returns a Range object that refers to the first 10 characters in the active document.
Set myRange = ActiveDocument.Range(Start:=0, End:=10)
Use the Range property to return a Range object defined by the beginning and end of another object. The Range property applies to many objects (for example, Paragraph, Bookmark, and Cell). The following example returns a Range object that refers to the first paragraph in the active document.
Set aRange = ActiveDocument.Paragraphs(1).Range
The following example returns a Range object that refers to the second through fourth paragraphs in the active document
Set aRange = ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(2).Range.Start, _
End:=ActiveDocument.Paragraphs(4).Range.End)
Properties
Application property, Bold property, BookmarkID property, Bookmarks property, Borders property, Case property, Cells property, Characters property, Columns property, Comments property, Creator property, Duplicate property, End property, Endnotes property, Fields property, Find property, Font property, Footnotes property, FormattedText property, FormFields property, Frames property, GrammarChecked property, GrammaticalErrors property, HighlightColorIndex property, Hyperlinks property, Information property, InlineShapes property, IsEndOfRowMark property, Italic property, LanguageID property, LanguageIDFarEast property, LanguageIDOther property, ListFormat property, ListParagraphs property, NextStoryRange property, Orientation property, PageSetup property, ParagraphFormat property, Paragraphs property, Parent property, PreviousBookmarkID property, ReadabilityStatistics property, Revisions property, Rows property, Sections property, Sentences property, Shading property, ShapeRange property, SpellingChecked property, SpellingErrors property, Start property, StoryLength property, StoryType property, Style property, Subdocuments property, SynonymInfo property, Tables property, Text property, TextRetrievalMode property, Underline property, Words property.
Methods
AutoFormat method, Calculate method, CheckGrammar method, CheckSpelling method, CheckSynonyms method, Collapse method, ComputeStatistics method, ConvertToTable method, Copy method, CopyAsPicture method, CreatePublisher method, Cut method, Delete method, EndOf method, Expand method, GetSpellingSuggestions method, GoTo method, GoToNext method, GoToPrevious method, InRange method, InsertAfter method, InsertAutoText method, InsertBefore method, InsertBreak method, InsertCaption method, InsertCrossReference method, InsertDatabase method, InsertDateTime method, InsertFile method, InsertParagraph method, InsertParagraphAfter method, InsertParagraphBefore method, InsertSymbol method, InStory method, IsEqual method, LookupNameProperties method, Move method, MoveEnd method, MoveEndUntil method, MoveEndWhile method, MoveStart method, MoveStartUntil method, MoveStartWhile method, MoveUntil method, MoveWhile method, Next method, NextSubdocument method, Paste method, PasteSpecial method, Previous method, PreviousSubdocument method, Relocate method, Select method, SetRange method, Sort method, SortAscending method, SortDescending method, StartOf method, SubscribeTo method, WholeStory method.
See Also
Selection object, TextRetrievalMode object.