Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Pivot Refresh Error when calling Excel Macro from VB.NET program
I am getting error
"Method 'PivotTables' of object '_Worksheet' failed" at line " Sheet1.PivotTables("PivotTable1").PivotCache.Refre sh" Snapshot of Macro code is given below. Using .NET program i paste data on the base data excel sheet. Using the below code (PivotTableWizard source data) i add the new range (StrRange) to the pivot and refresh. Above process works when run manually...using excel but errors out when called from the .NET program. Pls help. ---------------------------------------------------- 'Update Pivot Range Sheet1.Activate Sheet1.PivotTableWizard _ SourceType:=xlDatabase, _ SourceData:=Sheet2.Range(StrRange) ActiveWorkbook.ShowPivotTableFieldList = False 'Refresh Pivot Table Sheet1.PivotTables("PivotTable1").PivotCache.Refre sh 'PAUSE Process wait 30 'seconds 'Update Pivot Table Cache Dim pt As PivotTable Dim ws As Worksheet Dim pc As PivotCache 'Change the settings For Each ws In ActiveWorkbook.Worksheets For Each pt In ws.PivotTables pt.PivotCache.MissingItemsLimit = xlMissingItemsNone Next pt Next ws 'Refresh all the pivot caches For Each pc In ActiveWorkbook.PivotCaches On Error GoTo ErrLogger pc.Refresh Next pc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot Table refresh error | Excel Discussion (Misc queries) | |||
Excel 2003 Pivot Refresh Error | Excel Discussion (Misc queries) | |||
pivot table refresh macro | Excel Discussion (Misc queries) | |||
calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet | Excel Discussion (Misc queries) | |||
refresh pivot tables through a macro | Excel Worksheet Functions |