I have a snippet of VBA code that builds a pivot table from parameters that are passed into the subroutine. It works as expected:
objXL.ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
objXL.ActiveSheet.PivotTables("LODMPivot").AddFiel ds _
The parameter "psRowField" contains the value "Product" when this routine is called. I want to modify the pivot table by adding another row to the RowFields -- just doing this manually for now, with the expectation of putting the field name ('inventorymethod') into a new parameter. I added this line of code
objXL.ActiveSheet.PivotTables("LODMPivot").AddFiel ds RowFields:="inventorymethod", addtotable:=True
It creates the pivot table using ONLY the inventoryMethod, instead of adding it to the Product field that was already specified by the psRowField parameter. What's the correct syntax to add the new field into the Row area?
FWIW, the VBA Intellisense changes the case of "rowfields" into "RowFields", but it does not make the corresponding change for "addtotable". Finally, this code is hosted in an Access 97 database that creates the XL spreadsheet.