Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Set Pivot Table Pages

hi,

I am having some difficulty setting pagefields and values -- here is my
code...

strpivotsheet = "Pivot Table"
str_selection_value1 = "Delivery #"
str_selection_value2 = "Floor"
str_selection = "1"


For Each pt In Worksheets(strpivotsheet).PivotTables
With pt.PivotFields(str_selection_value1)
.Orientation = xlPageField
.Position = 1
End With
With pt.PivotFields(str_selection_value2)
.Orientation = xlPageField
.Position = 2
End With
Next pt

For Each pt In Worksheets(strpivotsheet).PivotTables
pt.PivotCache.Refresh
pt.RefreshTable
For Each pf In pt.PageFields
If pf.Name = str_selection_value1 Then
For Each pi In pf.PivotItems
If pi.Name = str_selection Then
pf.CurrentPage = pi.Name
Exit For
End If
Next pi
ElseIf pf.Name = str_selection_value2 Then
pf.CurrentPage = "(All)"
End If
Next pf
Next pt

on pf.CurrentPage = pi.name or pf.CurrentPage = "(All)" I get error 1004
application defined or object define error.

please help me.....

--
WayneR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Set Pivot Table Pages

I found my problem -- I don't know if this is just for files saved in 97-2203
compatible mode or not.. What I had to do was remove the "slect multiple"
from the pagefiled... it worked fine after that.....
--
WayneR


"WayneR" wrote:

hi,

I am having some difficulty setting pagefields and values -- here is my
code...

strpivotsheet = "Pivot Table"
str_selection_value1 = "Delivery #"
str_selection_value2 = "Floor"
str_selection = "1"


For Each pt In Worksheets(strpivotsheet).PivotTables
With pt.PivotFields(str_selection_value1)
.Orientation = xlPageField
.Position = 1
End With
With pt.PivotFields(str_selection_value2)
.Orientation = xlPageField
.Position = 2
End With
Next pt

For Each pt In Worksheets(strpivotsheet).PivotTables
pt.PivotCache.Refresh
pt.RefreshTable
For Each pf In pt.PageFields
If pf.Name = str_selection_value1 Then
For Each pi In pf.PivotItems
If pi.Name = str_selection Then
pf.CurrentPage = pi.Name
Exit For
End If
Next pi
ElseIf pf.Name = str_selection_value2 Then
pf.CurrentPage = "(All)"
End If
Next pf
Next pt

on pf.CurrentPage = pi.name or pf.CurrentPage = "(All)" I get error 1004
application defined or object define error.

please help me.....

--
WayneR

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
Print Pivot Table headers on pages with Pivot Table tsgoose Excel Worksheet Functions 0 December 9th 08 08:14 PM
linked 3 pivot table pages ????? shiro Excel Worksheet Functions 1 December 24th 07 02:33 PM
Show pages without using pivot table PA_Mom Excel Discussion (Misc queries) 1 March 9th 07 04:10 PM
Pivot Table help - select pages mjc Excel Discussion (Misc queries) 1 March 17th 06 03:40 PM
What happened to Pivot Table "Show Pages"? Jim Molter Excel Discussion (Misc queries) 3 June 22nd 05 08:45 PM


All times are GMT +1. The time now is 12:33 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"