Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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:
© 2015 Microsoft