Udostępnij za pośrednictwem


WorkbookBase.Sheets Property

Definition

Gets a Sheets collection that represents all the sheets in the workbook.

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

Property Value

A Sheets collection that represents all the sheets in the workbook.

Examples

The following code example uses the Sheets property to display the number of sheets in the workbook.

This example is for a document-level customization.

private void DisplayNumberOfSheets()
{
    MessageBox.Show("There are " + this.Sheets.Count +
        " sheets in this workbook.");
}
Private Sub DisplayNumberOfSheets()
    MsgBox("There are " & Me.Sheets.Count & _
        " sheets in this workbook.")
End Sub

Remarks

The collection includes worksheets, charts, dialog sheets and macro sheets in the workbook.

Applies to