ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot table visibility (https://www.excelbanter.com/excel-programming/273973-pivot-table-visibility.html)

newbie[_3_]

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?


All times are GMT +1. The time now is 03:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com