End Property
Applies To
Bookmark object, Range object, Selection object.
Description
Returns or sets the ending character position of a selection, range, or bookmark. Read/write Long.
Note If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End property are equal).
Remarks
The Selection, Range, and Bookmark objects all have a starting position and an ending position. The ending position is the point farthest away from the beginning of the story.
This property returns the ending character position relative to the beginning of the story. The main document story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.
See Also
Collapse method, InRange method, IsEqual method, Range method, SetRange method, Start property, StoryLength property.
Example
This example compares the ending position of the "temp" bookmark with the starting position of the "begin" bookmark.
Set Book1 = ActiveDocument.Bookmarks("begin")
Set Book2 = ActiveDocument.Bookmarks("temp")
If Book2.End > Book1.Start Then Book1.Select
This example retrieves the ending position of the selection. This value is used to create a range so that a field can be inserted after the selection.
pos = Selection.End
Set myRange = ActiveDocument.Range(Start:=pos, End:=pos)
ActiveDocument.Fields.Add Range:=myRange, Type:=wdFieldAuthor
This example changes the ending position of myRange by one character.
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.End = myRange.End - 1