Expand Minimize

Bookmark.Next Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets a Range object that represents the specified unit relative to the Bookmark control.

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

Range Next(
	ref Object Unit,
	ref Object Count


Type: System.Object

The type of units by which to count. Can be any WdUnits constant.

Type: System.Object

The number of units by which you want to move ahead. The default value is one.

Return Value

Type: Microsoft.Office.Interop.Word.Range
A Range object that represents the specified unit relative to the Bookmark control.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example adds a Bookmark control with text to the first paragraph, inserts additional text after the bookmark, and then displays the next word after the bookmark in a message box.

This example is for a document-level customization.

private void BookmarkNext()
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
    bookmark1.Text = "This is sample bookmark text.";
    bookmark1.InsertAfter (" This text is inserted after the bookmark.");

    object Unit = Word.WdUnits.wdWord;
    object Count = 1;

    Word.Range range1 = bookmark1.Next(ref Unit, ref Count);

    MessageBox.Show("The next word after Bookmark1 is at " +	
        "position " + range1.Start + " through " + range1.End);

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft