Bookmark.End Property (2007 System)

Gets or sets the ending character position of a Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Property End As Integer
'Usage
Dim instance As Bookmark 
Dim value As Integer 

value = instance.End

instance.End = value
public int End { get; set; }
public:
property int End {
    int get ();
    void set (int value);
}
public function get End () : int 
public function set End (value : int)

Property Value

Type: System.Int32
The ending character position of a Bookmark control.

Remarks

The Bookmark control has a starting position and an ending position. The ending position is the point farthest away from the beginning of the Bookmark control. Use the End property to change the size of the Bookmark control.

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).

Examples

The following code example adds a Bookmark control with text to the first paragraph and then adds another Bookmark control to the third word in the first bookmark. The code then moves the range of the second bookmark until it finds the character K.

This example is for a document-level customization.

Private Sub BookmarkMoveEndUntil()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This is sample bookmark text." 

    Dim Bookmark2 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Bookmark1.Words(3), "Bookmark2")

    Bookmark2.MoveEndUntil("k", Bookmark1.Characters.Count)
End Sub
private void BookmarkMoveEndUntil()
{
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";

    Microsoft.Office.Tools.Word.Bookmark bookmark2 =
        this.Controls.AddBookmark(bookmark1.Words[3],
        "bookmark2");

    object Count = bookmark1.Characters.Count;
    object cSet = "k";

    bookmark2.MoveEndUntil(ref cSet, ref Count);
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace