Thread: About PageField
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Debra Dalgleish Debra Dalgleish is offline
external usenet poster
 
Posts: 2,979
Default About PageField

The following code will list the page field items on a new worksheet:

'==============
Sub ListFields()
'lists all page field items on a new worksheet
Dim ws As Worksheet
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim rw As Integer
Set ws = Worksheets.Add
ws.Activate
Set pt = Worksheets("Pivot").PivotTables(1)
rw = 0
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
rw = rw + 1
ws.Cells(rw, 1).Value = pi.Name
Next
Next pf
End Sub
'=====================

Polly wrote:
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

.PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html