Bookmark.Creator Property

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

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

Syntax

'Declaration
ReadOnly Property Creator As Integer
int Creator { get; }

Property Value

Type: System.Int32
The application in which the Bookmark control was created.

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.

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

.NET Framework Security

See Also

Reference

Bookmark Interface

Microsoft.Office.Tools.Word Namespace