Bookmark.PreviousBookmarkID Property (2007 System)

Gets a value that represents the number of the last bookmark that starts before or at the same place as the Bookmark control.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property PreviousBookmarkID As Integer
'Usage
Dim instance As Bookmark 
Dim value As Integer 

value = instance.PreviousBookmarkID
[BrowsableAttribute(false)]
public int PreviousBookmarkID { get; }
[BrowsableAttribute(false)]
public:
property int PreviousBookmarkID {
    int get ();
}
public function get PreviousBookmarkID () : int

Property Value

Type: System.Int32
The number of the last bookmark that starts before or at the same place as the Bookmark control.

Remarks

The PreviousBookmarkID property returns 0 (zero) if there is no corresponding bookmark.

Examples

The following code example adds a Bookmark control with text to the document and displays the name of the bookmark in a message box using the PreviousBookmarkID property.

This example is for a document-level customization.

Private Sub BookmarkPreviousBookmarkID()

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

    MessageBox.Show(Me.Bookmarks(Bookmark1.PreviousBookmarkID).Name)

End Sub
private void BookmarkPreviousBookmarkID()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";

    object bookmarkID = bookmark1.PreviousBookmarkID;
    MessageBox.Show (this.Bookmarks.get_Item(ref bookmarkID).Name);
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Microsoft.Office.Tools.Word Namespace