Share via


WorkbookBase.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.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property CustomViews As CustomViews
    Get
public CustomViews CustomViews { get; }

Property Value

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

Examples

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.

This example is for a document-level customization.

Private Sub AddCustomView()
    Me.CustomViews.Add("Summary", True, True)
    Me.Application.Dialogs( _
        Excel.XlBuiltInDialog.xlDialogCustomViews).Show()
End Sub
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);
}

.NET Framework Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace