Pivot table selection

J

John Thomas

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
 

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

Top