Hello, I suspect this is a simple problem but for the life of me I don't know what is going wrong. I have a pivot table in another workbook, with cube source data. I get an error when trying to enable multiple selections.I got the Cube field names from recording a macro. If I manually enable when it debugs, then it works fine after that. Code is below I hope someone can help!
Code:
Workbooks.Open (Inbook)
Inbook = ActiveWorkbook.name
Set InSheet = ActiveWorkbook.ActiveSheet
InSheet.Activate
'******Error occurs here!!!!! Works if I enable manually when it debugs.....
ActiveSheet.PivotTables("PivotTable1").CubeFields(31).EnableMultiplePageItems = True
'*************
ActiveSheet.PivotTables("PivotTable1").PivotFields("[Project].[Region].[Region]").VisibleItemsList = RegArray()