共用方式為


WorkbookBase.CustomViews 屬性

取得 Microsoft.Office.Interop.Excel.CustomViews 集合,表示活頁簿所有自訂檢視。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

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

屬性值

型別:Microsoft.Office.Interop.Excel.CustomViews
Microsoft.Office.Interop.Excel.CustomViews 集合,表示活頁簿所有自訂檢視。

範例

下列程式碼範例使用 CustomViews 屬性,將名為 "Summary" 的自訂檢視加入目前工作表,然後以程式設計方式顯示 [自訂檢視] 對話方塊,展示已建立新的自訂檢視。

這是示範文件層級自訂的範例。

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 安全性

請參閱

參考

WorkbookBase 類別

Microsoft.Office.Tools.Excel 命名空間