This documentation is archived and is not being maintained.

Workbook.CustomViews Property

Gets a Microsoft.Office.Interop.Excel.CustomViews collection that represents all the custom views for the workbook.

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

public virtual CustomViews CustomViews { get; }

Property Value

A Microsoft.Office.Interop.Excel.CustomViews collection that represents all the custom views for the workbook.

The following code example uses the CustomViews property to add a custom view named "Summary" to the current workbook, and then programmatically displays the Custom Views dialog to demonstrate that the new custom view was created.

private void AddCustomView()
{
    this.CustomViews.Add("Summary", true, true);

    this.Application.Dialogs[Excel.XlBuiltInDialog.xlDialogCustomViews].Show(
        missing, missing, missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing, missing, missing,
        missing, missing, missing, missing, missing, missing);
}

Show: