다음을 통해 공유


NamedRange.Creator Property

Definition

Gets a 32-bit integer that indicates the application in which the NamedRange control was created.

public:
 property Microsoft::Office::Interop::Excel::XlCreator Creator { Microsoft::Office::Interop::Excel::XlCreator get(); };
public Microsoft.Office.Interop.Excel.XlCreator Creator { get; }
member this.Creator : Microsoft.Office.Interop.Excel.XlCreator
Public ReadOnly Property Creator As XlCreator

Property Value

One of the XlCreator values.

Examples

The following code example creates a NamedRange and then uses the Creator property to determine whether the NamedRange was created in Microsoft Office Excel.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange displayCreatorRange;
private void DisplayCreator()
{
    displayCreatorRange = this.Controls.AddNamedRange(
        this.Range["C3", "E5"], "displayCreatorRange");
    displayCreatorRange.Select();
    if (this.displayCreatorRange.Creator == 
        Excel.XlCreator.xlCreatorCode)
    {
        MessageBox.Show("This NamedRange control was created in " +
            "Microsoft Office Excel.");
    }
    else
    {
        MessageBox.Show("This NamedRange control was not created in " +
            "Microsoft Office Excel.");
    }
}
Private displayCreatorRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub DisplayCreator()
    displayCreatorRange = Me.Controls.AddNamedRange( _
        Me.Range("C3", "E5"), "displayCreatorRange")
    displayCreatorRange.Select()
    If Me.displayCreatorRange.Creator = _
        Excel.XlCreator.xlCreatorCode Then
        MessageBox.Show("This NamedRange control was " & _
            "created in Microsoft Office Excel.")
    Else
        MessageBox.Show("This NamedRange control was " & _
            "not created in Microsoft Office Excel.")
    End If
End Sub

Remarks

If the NamedRange control was created in Microsoft Office Excel, this property returns the hexadecimal number 5843454C, which is equivalent to string XCEL.

Applies to