Udostępnij za pośrednictwem


Workbook.Sheets Property (2007 System)

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

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 Sheets As Sheets
'Usage
Dim instance As Workbook 
Dim value As Sheets 

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

Property Value

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

Remarks

The collection includes worksheets, charts, dialog sheets and macro 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 Sub DisplayNumberOfSheets()
    MsgBox("There are " & Me.Sheets.Count & _
        " sheets in this workbook.")
End Sub
private void DisplayNumberOfSheets()
{
    MessageBox.Show("There are " + this.Sheets.Count +
        " sheets in this workbook.");
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace