Partager via


Bookmark.Creator Property

Definition

Gets a value that indicates the application in which the Bookmark control was created.

public:
 property int Creator { int get(); };
public int Creator { get; }
member this.Creator : int
Public ReadOnly Property Creator As Integer

Property Value

The application in which the Bookmark control was created.

Examples

The following code example adds a Bookmark control with text to the first paragraph of the document and then displays the creator application in a message box.

This example is for a document-level customization.

private void BookmarkCreator()
{
    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.";
    
    if (bookmark1.Creator == (int)Word.WdConstants.wdCreatorCode)
    {
        MessageBox.Show("The Bookmark was created in Microsoft Office Word");
    }
}
Private Sub BookmarkCreator()

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

    If Bookmark1.Creator = Fix(Word.WdConstants.wdCreatorCode) Then
        MessageBox.Show("The Bookmark was created in " & _
            "Microsoft Office Word")
    End If

End Sub

Remarks

Because the Bookmark control is created in Microsoft Office Word, this property returns the hexadecimal number 4D535744, which represents the string "MSWD." This value can also be represented by the constant wdCreatorCode.

Applies to