PivotTables.SubtotalLocation not working? RRS feed

  • Question

  • In creating a Ribbon button to create a Pivot table from a AS Cube, I'm adding a button to add the subtotals at the bottom with an additional button shown below.  The code appears to work since I don't get any errors but nothing seems to happen.  I'm trying to replicate the Subtotal button on the Design tab from the Pivot Table menu.  I even tried to add this formatting right after creating the PT and before the PV is populated with no change.  Any suggestions or guidance is greatly appreciated. 

    private void button1_Click(object sender, RibbonControlEventArgs e)
                //object init
                var _Workbook = Globals.ThisAddIn.GetActiveWorkbook();
                var _Sheet = Globals.ThisAddIn.GetActiveWorksheet();
                var _Range = Globals.ThisAddIn.GetActiveCell();

                //unique pivot table name
                string pivotTableName = _Sheet.Name + "_" + _Range.Address;


    Thanks in Advance.

    Thursday, April 11, 2019 10:32 PM