View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
iD iD is offline
external usenet poster
 
Posts: 2
Default PivotItems.Count is 0 when items are visible on the sheet

Hi again
Does anybody have even the slightest idea about this please?

I can't find anything about it, not even on Microsoft's site.

Many thanks
iD

iD wrote:
Hi All
I have a Pivot Table report (Excel 2003 sp1) connecting to a cube on
SQL Server 2000 (sp 3a) and am trying to enumerate through a pivot
field so that I can print a report for each item in it.

On the worksheet there are 20 or so items selectable, but when I try
to select one through code, the items count is 0.

Below is a fragment of code that I am using (taken from other
postings!):

'
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

Set pt = ActiveSheet.PivotTables.Item("PivotTable1")

' this is ok as I can do pf.Name
Set pf = pt.PivotFields("[Department]")

' this always displays 0
MsgBox pf.PivotItems.Count
'

Does anyone have any sugestions please?!?!

I have tried ChildItems and also working through CubeFields but by

the
time I get to PivotItems it all ends!!!

Incidently ColumnFields seems ok, but I can't use this because of the
way I have to format the report.


Many thanks for any help/suggestions
iD