View Single Post
 
Old 03-13-2014, 09:56 AM
Wries Wries is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: Jun 2009
Posts: 40
Wries is on a distinguished road
Default VBA Pivot Table CubeField Enable multiple items

Hi All,
I need a macro that will set certain pivot fields to (All). It all works like a charm as far as multiple items selection is disabled.
I either need macro to select all items or to disable the multiple selection and then select all.
The below code returns run time 1004 app-def or object-def error at the row where i am trying to set to false, OLAP pivot so i cannot use all the features. Unless I find a solution to the below i will have to create slicers for each field and then make the macro to clear the slicer (set all visible).

Code:
Sub test()
Dim PT As PivotTable
Dim PF As PivotField
    Set PT = ActiveSheet.PivotTables("Pivot2014")
    Set PF = PT.PivotFields("Product")
    
    PF.CubeField.EnableMultiplePageItems = False
 End Sub
Please advise.

Thank you,
Kind regards,
Wries
Reply With Quote