title: Selecting multiple items in excel pivot table filter
body: <p>I am using vba to create a pivot table. The table has some filters and i am unable to select multiple items from the filter.</p>
  
  <p>I recorded a macro and used the same functions as the system generated code but i am getting</p>
  
  <pre><code>"Run-time error '1004': Unable to set the CurrentPage Property of the PivotField Class"
  </code></pre>
  
  <p>Below is the code that is used to create the pivot table, which works:</p>
  
  <pre><code>Dim objTable As PivotTable
      Dim objField As PivotField
  
      ' Select the sheet and first cell of the table that contains the data.
      ActiveWorkbook.Sheets("All Projects - iNexus").Select
      Range("A1").Select
  
      ' Create the PivotTable object based on the Employee data on Sheet1.
      Set objTable = ActiveSheet.PivotTableWizard
  
      ' Specify row and column fields.
      Set objField = objTable.PivotFields("Product")
      objField.Orientation = xlRowField
      Set objField = objTable.PivotFields("SPA Value Category")
      objField.Orientation = xlColumnField
  
      ' Specify a data field with its summary
      ' function and format.
      Set objField = objTable.PivotFields("2014 FY Value ($)")
      objField.Orientation = xlDataField
      objField.Function = xlSum
      objField.NumberFormat = "$ #,##0"
  
      Set objField = objTable.PivotFields("2015 FY Value ($)")
      objField.Orientation = xlDataField
      objField.Function = xlSum
      objField.NumberFormat = "$ #,##0"
  
      ActiveSheet.Name = "iNexus Pivot"
  
      ' Rename the pivot table
      With Sheets("iNexus Pivot")
          .PivotTables(1).Name = "PivotTable2"
      End With
  
      With Sheets("iNexus Pivot").PivotTables("PivotTable2").DataPivotField
          .Orientation = xlColumnField
      End With
  </code></pre>
  
  <p>THis is code that i got from the recorded macro to select multiple items from the recorded macro:</p>
  
  <pre><code>ActiveSheet.PivotTables("PivotTable2").PivotFields("Project Status"). _
      CurrentPage = "(All)"
      With ActiveSheet.PivotTables("PivotTable2").PivotFields("Project Status")
          .PivotItems("A").Visible = False
          .PivotItems("B").Visible = False
          .PivotItems("C").Visible = False
      End With
      ActiveSheet.PivotTables("PivotTable2").PivotFields("Project Status"). _
          EnableMultiplePageItems = True
  </code></pre>
  
  <p>Both CurrentPage and PivotItems seem to be the source of the problem, my vba skills are very limited and i am unable to debug the problem.</p>
  
  <p>Thanks. Appreciate the help.</p>