View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CRL CRL is offline
external usenet poster
 
Posts: 1
Default Error updating pivot table source data

Hi,

I'm trying to write a VB 6 app that updates the source
range for a set of pivot tables. Specifically, I'm using
the following code:

Set xlOutputSheet = xlOutputWorkbook.Sheets("MySheet")
Set xlPivot = xlOutputSheet.PivotTables _
("MyPivotTable")
Set xlPivotCache = xlPivot.PivotCache
RangeString = "MyOtherSheet!R2C1:R" & _
(Table_Dimension) & "C10"
With xlPivotCache
.SourceData = RangeString
.Refresh
End With

For most of the pivot tables, this works. However,
occasionally, for a reason I can't deduce I get the
following error:

"Application-defined or object-defined error"
at ".SourceData = RangeString". I'm pretty certain the
RangeString is correct.

Any insight would be helpful.

Thanks,

Craig