Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Set  Pivot Table Pages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WayneR - 22 May 2008 21:08 GMT
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.....

Signature

WayneR

WayneR - 23 May 2008 20:18 GMT
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.....
Signature

WayneR

> hi,
>
[quoted text clipped - 39 lines]
>
> please help me.....
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.