共用方式為


WorkbookBase.Creator Property

Definition

Gets the application in which the workbook 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 uses the Creator property to display whether the current workbook was created in Microsoft Office Excel.

This example is for a document-level customization.

private void DisplayCreator()
{
    if (this.Creator == Excel.XlCreator.xlCreatorCode)
    {
        MessageBox.Show("This workbook was created in " +
            "Microsoft Office Excel.");
    }
    else
    {
        MessageBox.Show("This workbook was not created in " +
            "Microsoft Office Excel.");
    }
}
Private Sub DisplayCreator()
    If Me.Creator = Excel.XlCreator.xlCreatorCode Then
        MsgBox("This workbook was created in " & _
            "Microsoft Office Excel.")
    Else
        MsgBox("This workbook was not created in " & _
            "Microsoft Office Excel.")
    End If
End Sub

Remarks

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

This property is designed to be used in Excel for the Macintosh, where each application has a four-character creator code. For example, Excel has the creator code XCEL.

Applies to