Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Changing pivot table Page

I am trying to loop through all pages within a pivot table, my code for the
loop is below.

It seems to be looping and returning the page names, but it doesn't display
the relavant page on the spreadsheet.

I confess that I am a complete newbee to VB and would be gratefull for any
help

With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Job Description")
For Each itm In .PivotItems
CurrentPage = itm
Next
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Changing pivot table Page

Thanks in advance to anyone who was going to comment, but with perseverence I
have resolved my problem.

"Jason" wrote:

I am trying to loop through all pages within a pivot table, my code for the
loop is below.

It seems to be looping and returning the page names, but it doesn't display
the relavant page on the spreadsheet.

I confess that I am a complete newbee to VB and would be gratefull for any
help

With ActiveSheet.PivotTables("PivotTable2").PivotFields ("Job Description")
For Each itm In .PivotItems
CurrentPage = itm
Next
End With

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Changing pivot table Page

Hi

Based on my understanding, you create a pivottable on the an Excel
WorkSheet, but not the SpreadSheet Office Web Component.
For OWC issue, it would better to post in the newsgroup below.
microsoft.public.office.developer.web.components

The hierarchical structure of the Pivot Table is as below.
If we created one PivotTable on the Sheet1 in Excel Workbook. Then there
will be one PivotTable in the Sheet1.PivotTables collection.
Analogously, there are a collection PivotFields under the PivotTable, a
collection PivotItems under the PivotField.

Sub Test()
On Error Resume Next
Dim pv As PivotTable
Set pv = Sheet1.PivotTables(1)
Dim pf As PivotField
Dim pi As PivotItem
For Each pf In pv.PivotFields
Debug.Print pf.CurrentPageName
For Each pi In pf.PivotItems
Debug.Print " " & pi.Caption
Next
Next
End Sub

For every object's properties and methods we can refer to the vba help file.
It is located under the path below.
<Microsoft Office\OFFICE11\1033\VBAXL10.CHM

CurrentPageName Property
Returns or sets the currently displayed page of the specified PivotTable
report. The name of the page appears in the page field. Note that this
property works only if the currently displayed page already exists.
Read/write String.

Also I did not understanding your scenario very much. Can you post more
information what you do you mean by "the relavant page on the spreadsheet"?
Can you post the xls file you are using together with what you want to show
with VBA?

Thanks for your efforts!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

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
changing a calculation in a pivot table pat67 Excel Worksheet Functions 0 February 22nd 10 08:56 PM
Pivot Table changing itself? PaulW Excel Discussion (Misc queries) 1 February 16th 07 03:18 PM
Pivot Tables -changing datasource for exsting Pivot Table kfschaefer Setting up and Configuration of Excel 0 May 30th 06 06:36 PM
Changing a pivot table page or data set by using a macro [email protected] Excel Programming 1 June 16th 05 01:01 AM
VBA Code for a pivot table to open database and to reference table current page Pete Straman Straman via OfficeKB.com Excel Programming 0 February 21st 05 03:57 AM


All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"