Share via


WorksheetBase.Type Property

Gets the worksheet type.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Type As XlSheetType
public XlSheetType Type { get; }

Property Value

Type: XlSheetType
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 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
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;
    }
}

.NET Framework Security

See Also

Reference

WorksheetBase Class

Microsoft.Office.Tools.Excel Namespace