View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
newbie[_3_] newbie[_3_] is offline
external usenet poster
 
Posts: 1
Default Pivot table visibility

The problem is about VBA programming with pivot tables
created using OLAP cubes.

I am using the following code to hide a row item of a
pivot table created from an OLAP Cube. I get an error in
the second line:
----------------------------------------
Run Time error 1004
Unable to set the visible property of the pivot item class
-----------------------------------------
------------
Worksheets("sheet1").PivotTables(1) _
..PivotFields("[Project].[Project Name]").AutoSort
xlManual, "[Project].[Project Name]"

Worksheets("sheet1").PivotTables(1) _
..PivotFields("[Project].[Project Name]").PivotItems
("[Project].[All Project].[ProjectA]").Visible = False
-----------
This code works properly with pivot table created from
excel sheet data but not with pivot tables created using
OLAP cubes.

I get this error whatever way I alter the visible
property of a pivot item. This error can be reproduced
easily by using the sample foodmart cube.

I have already looked at Q114822 and the error appears
even if I follow that guideline.

Any ideas?