Export (0) Print
Expand All
Expand Minimize

Workbook.Excel4MacroSheets Property

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

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual Sheets Excel4MacroSheets { get; }

Property Value

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

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.

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);
    }
}

Show:
© 2014 Microsoft