Export (0) Print
Expand All
Expand Minimize

Workbook.PivotCaches Method

Gets a Microsoft.Office.Interop.Excel.PivotCaches collection that represents all the PivotTable caches in the specified workbook.

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

public virtual PivotCaches PivotCaches ()

Return Value

A Microsoft.Office.Interop.Excel.PivotCaches collection that represents all the PivotTable caches in the specified workbook.

The following code example uses the PivotCaches method to set each Microsoft.Office.Interop.Excel.PivotCache in the current workbook to update automatically each time the workbook is opened.

private void WorkbookPivotCaches()
{
    Excel.PivotCaches caches = this.PivotCaches();

    if (caches != null)
    {
        for (int i = 1; i < caches.Count; i++)
        {
            caches[i].RefreshOnFileOpen = true;
        }
    }
}

Show:
© 2014 Microsoft