Worksheet.Type Property (2007 System)

Gets the worksheet type.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Type As XlSheetType
'Usage
Dim instance As Worksheet 
Dim value As XlSheetType 

value = instance.Type
[BrowsableAttribute(false)]
public XlSheetType Type { get; }
[BrowsableAttribute(false)]
public:
property XlSheetType Type {
    XlSheetType get ();
}
public function get Type () : XlSheetType

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

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace