About PageField

  • Thread starter Thread starter Polly
  • Start date Start date
P

Polly

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
 
Hi Polly

Sub test()
With ActiveSheet.PivotTables("PivotTable1")
Dim i As Integer
For i = 1 To .PageFields.Count
MsgBox .PageFields(i)
Next i
End With
End Sub

--
XL2002
Regards

William

(e-mail address removed)

| 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
 
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
'=====================
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
 
Hi Polly

I dont think my first post fully answered your question.

Sub test()
With ActiveSheet.PivotTables("PivotTable1")
Dim i As Integer, ii As Integer
For i = 1 To .PageFields.Count
With .PageFields(i)
For ii = 1 To .PivotItems.Count
MsgBox .PivotItems(ii)
Next ii
End With
Next i
End With
End Sub

--
XL2002
Regards

William

(e-mail address removed)

| 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
 
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly
 
I am using OLAP cube to create the pivot table.
Will OLAP affect the result?

Best Wishes,
Polly

-----Original Message-----
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly


-----Original Message-----
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
.
.
 
Try it and tell us.

--
Regards,
Tom Ogilvy

Polly said:
I am using OLAP cube to create the pivot table.
Will OLAP affect the result?

Best Wishes,
Polly

-----Original Message-----
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly


-----Original Message-----
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
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top