共用方式為


Bookmark.Name Property

Definition

Gets the name of the Bookmark control.

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

Property Value

The name of the Bookmark control.

Examples

The following code example adds a Bookmark control with text to the first paragraph and then displays the bookmark's name in a message box.

This example is for a document-level customization.

private void BookmarkName()
{
    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.";
    MessageBox.Show("The bookmark's name is " + bookmark1.Name);
}
Private Sub BookmarkName()
    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("The bookmark's name is " & Bookmark1.Name)

End Sub

Applies to