次の方法で共有


WorkbookBase.Excel4MacroSheets Property

Definition

Gets a Sheets collection that represents all the Microsoft Office Excel 4.0 macro sheets in the workbook.

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

Property Value

A Sheets collection that represents all the Microsoft Office Excel 4.0 macro sheets in the workbook.

Remarks

The following code example iterates through every Microsoft.Office.Interop.Excel.Worksheet returned by the Excel4MacroSheets property and writes the code name of each worksheet to the debug output.

This example is for a document-level customization.

private void DisplayExcel4MacroSheets()
{
    Excel.Sheets sheetsCollection = this.Excel4MacroSheets;
    for (int i = 1; i < sheetsCollection.Count; i++)
    {
        Excel.Worksheet sheet = (Excel.Worksheet)sheetsCollection[i];
        System.Diagnostics.Debug.WriteLine(sheet.CodeName);
    }
}
Private Sub DisplayExcel4MacroSheets()
    Dim sheetsCollection As Excel.Sheets = Me.Excel4MacroSheets
    Dim i As Integer
    For i = 1 To sheetsCollection.Count
        Dim sheet As Excel.Worksheet = _
            CType(sheetsCollection(i), Excel.Worksheet)
        System.Diagnostics.Debug.WriteLine(sheet.CodeName)
    Next i
End Sub

Applies to