Share via


Bookmark.ID Property

Definition

Gets or sets the identifying label for the Bookmark control when the current document is saved as a Web page.

public:
 property System::String ^ ID { System::String ^ get(); void set(System::String ^ value); };
public string ID { get; set; }
member this.ID : string with get, set
Public Property ID As String

Property Value

The identifying label for the Bookmark control when the current document is saved as a Web page.

Examples

The following code example adds a Bookmark control with text to the document and then sets the ID property to Sample.

This example is for a document-level customization.

private void BookmarkID()
{
    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.";
    bookmark1.ID = "Sample";
}
Private Sub BookmarkID()
    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."
    Bookmark1.ID = "Sample"

End Sub

Remarks

This is different from the BookmarkID property, and does not imply the order the bookmark appears in the document.

Applies to