Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help! Turning off PivotTable Subtotals
Hello,
I'm trying to turn off Excel 2002 PivotTable Subtotals using C#.NET. I'm able to set other field properties, but I cannot figure out how to use the set_Subtotals method or locate that .Subtotals property that so many Excel 97 programming examples use. Sample of my attached code below. Any help would be greatly appreciated. Thanks, Jim Excel._Workbook oWB; Excel._Worksheet oSheet; Excel.PivotCache pivotCache; Excel.PivotTable pivotTable; Excel.PivotField pivotField; string sourceData; Excel.Range oRng; oWB = mXL.Workbook; oSheet = (Excel.Worksheet) oWB.Sheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing); oRng = oSheet.get_Range ("A7","A7").Cells; Excel.PivotCaches pivotCaches = oWB.PivotCaches(); sourceData = "Data!R1C1:R" + mLastRow + "C" + mLastCol; pivotCache = pivotCaches.Add (Excel.XlPivotTableSourceType.xlDatabase, sourceData); pivotTable = pivotCache.CreatePivotTable(oRng, "Flow-Through", Type.Missing, Excel.XlPivotTableVersionList.xlPivotTableVersionC urrent); pivotTable.SmallGrid = false; // Pivot Table Page Area pivotField = (Excel.PivotField) pivotTable.PivotFields("Region"); pivotField.Orientation = Excel.XlPivotFieldOrientation.xlPageField; pivotField.Position = 1; pivotField = (Excel.PivotField) pivotTable.PivotFields("Opportunity Owner"); pivotField.Orientation = Excel.XlPivotFieldOrientation.xlPageField; pivotField.Position = 1; // Pivot Table Row Area pivotField = (Excel.PivotField) pivotTable.PivotFields("Account Name"); pivotField.Orientation = Excel.XlPivotFieldOrientation.xlRowField; pivotField.Position = 1; |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Globally deleted SubTotals in a PivotTable | Excel Discussion (Misc queries) | |||
Creating a PivotTable w/o selecting data in an existing PivotTable | Excel Discussion (Misc queries) | |||
Why are some subtotals missing from my pivottable? | Excel Discussion (Misc queries) | |||
Turning off pivot table subtotals in Excel 2002 | Excel Discussion (Misc queries) | |||
PivotTable Automatic Subtotals | Excel Discussion (Misc queries) |