View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Thomas John Thomas is offline
external usenet poster
 
Posts: 2
Default Pivot table selection

Hi all,

I am using pivot tables that talkes to a OLAP cube. The sheet shows
information like this:

Project Plan
------- -----
ProjectA $200
ProjectB $300
ProjectC $500

Can I pass the project name as input to this workbook so that when this
sheet opens up it shows only one project that was requested.
Something like this:

Run excel projectinfo.xls 'projectb' , should open this excel sheet with
just "ProjectB", like this:

Project Plan
------- -----
ProjectB $300


I have this code (got from this group):

Private Sub Workbook_Open()

ActiveSheet.PivotTables("PivotTable1"). _
PivotFields("Project").CurrentPage = "ProjectB"

End Sub

My questions:
--------------
(1) This code as such doesnt work, I get a error like this:

run-time error '1004':
unable to get the pivotfields property of the pivottable class

(2) How can I pass a string to Workbook_Open() so that project that needs to
be shown is passed as a parameter ?

(3) Is there a good book by which I can learn Pivot table VBA programming ?

Thanks,
John