Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table refresh error Darby Excel Discussion (Misc queries) 1 October 8th 07 03:57 PM
Excel 2003 Pivot Refresh Error Ang Excel Discussion (Misc queries) 0 July 13th 07 03:46 PM
pivot table refresh macro kraway Excel Discussion (Misc queries) 2 November 14th 06 02:38 PM
calling a C++ program from Excel 2000 and passing a result from C++ back to an excel spreadsheet ellis kurland Excel Discussion (Misc queries) 3 August 15th 05 04:10 PM
refresh pivot tables through a macro dolph Excel Worksheet Functions 1 January 12th 05 03:16 AM


All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"