Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default I dare you to help me! Somebody, anybody...

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dare Format Don Ellet Excel Worksheet Functions 4 June 13th 06 06:38 PM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"