共用方式為


WorksheetBase.Creator 屬性

取得值,指出建立工作表所在的應用程式。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property Creator As XlCreator
public XlCreator Creator { get; }

屬性值

型別:Microsoft.Office.Interop.Excel.XlCreator
如果工作表是在 Excel 中建立,則這個屬性會傳回字串 XCEL,這個字串相當於十六進位數字 5843454C。

備註

這個屬性是 Macintosh 中的 Microsoft Office Excel 所專用,每一個應用程式在 Macintosh 中都有四個字元的建立者代碼。 例如,Excel 的建立者代碼為 XCEL。

範例

下列程式碼範例會使用 Creator 屬性,顯示目前的工作表是否在 Microsoft Office Excel 中建立。

這是示範文件層級自訂的範例。

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

.NET Framework 安全性

請參閱

參考

WorksheetBase 類別

Microsoft.Office.Tools.Excel 命名空間