Bookmark.Creator Property

Definition

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

C#
public int Creator { get; }

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.

C#
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");
    }
}

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

Product Versions
Visual Studio Tools for Office 2017, 2019, 2022