Store hidden pivot items in vba from an OLAP Source Excel 2013

hotaru

New Member
Joined
Aug 14, 2015
Messages
1
Here is the situation. I'm trying to record the filter settings of an OLAP based pivot table. I plan to switch sources to a different OLAP in a different program (but containing the same data) and then rebuild the pivot with new pivotfield and pivot item names. I have setting the fields done and the drill down done. The problem is that I have the vba to filter the rows, but it doesn't work on the columns.

When I record the Macro for filtering columns i get this:

Code:
ActiveSheet.PivotTables("PivotTable2").PivotFields( _
        "[Date].[Fiscal].[Fiscal Year]").HiddenItemsList = Array( _
        "[Date].[Fiscal].[Fiscal Year].&[2006]", "[Date].[Fiscal].[Fiscal Year].&[2008]")

What I need is a way to store the Hidden Items. In this case I would want to store "[Date].[Fiscal].[Fiscal Year].&[2006]", "[Date].[Fiscal].[Fiscal Year].&[2008].

I have tried cycling through each item with code like this but the items that are hidden never get cycled through. Its almost as if they don't exist.
Code:
For Each t In .PivotItems
    MsgBox (t.Name)
     If t.Visible = False Then MsgBox (t.Name & " is hidden")
    Next

Finally, I have tried replacing the .HiddenItemsList with .VisibleItemsList and I get an application defined or object defined error.

Any Help on this would be greatly appreciated. Or just an Idea of WHY VisibleItemsList works for rowfields but not columnfields.

Thank you
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,215,487
Messages
6,125,085
Members
449,206
Latest member
ralemanygarcia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top