WorksheetBase.Type Property

Definition

Gets the worksheet type.

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

Property Value

One of the XlSheetType values.

Examples

The following code example uses the Type property to display whether the current worksheet is a worksheet, a dialog sheet, or a chart in a message box.

This example is for a document-level customization.

private void ShowType()
{
    switch (this.Type)
    {
        case Excel.XlSheetType.xlWorksheet:
            MessageBox.Show("This is a worksheet.");
            break;
        case Excel.XlSheetType.xlDialogSheet:
            MessageBox.Show("This is a dialogsheet.");
            break;
        case Excel.XlSheetType.xlChart:
            MessageBox.Show("This is a chart.");
            break;
    }
}
Private Sub ShowType()
    Select Case Me.Type
        Case Excel.XlSheetType.xlWorksheet
            MsgBox("This is a worksheet.")
        Case Excel.XlSheetType.xlDialogSheet
            MsgBox("This is a dialogsheet.")
        Case Excel.XlSheetType.xlChart
            MsgBox("This is a chart.")
    End Select
End Sub

Applies to