Udostępnij za pośrednictwem


Workbook.PivotCaches Method (2007 System)

Gets a PivotCaches collection that represents all the PivotTable caches in the specified workbook.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Function PivotCaches As PivotCaches
'Usage
Dim instance As Workbook 
Dim returnValue As PivotCaches 

returnValue = instance.PivotCaches()
public PivotCaches PivotCaches()
public:
PivotCaches^ PivotCaches()
public function PivotCaches() : PivotCaches

Return Value

Type: PivotCaches
A PivotCaches collection that represents all the PivotTable caches in the specified workbook.

Examples

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

This example is for a document-level customization.

Private Sub WorkbookPivotCaches()
    Dim caches As Excel.PivotCaches = Me.PivotCaches()

    If Not (caches Is Nothing) Then 
        Dim i As Integer 
        For i = 1 To caches.Count
            caches(i).RefreshOnFileOpen = True 
        Next i
    End If 
End Sub
private void WorkbookPivotCaches()
{
    Excel.PivotCaches caches = this.PivotCaches();

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

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace