pivot tables

juliemac

New member
Joined
Apr 19, 2005
Messages
4
Programming Experience
10+
I am in the process of converting a VB6 program to Dot.net 10.
I havre most of the code re-written, creating the excel book and sheets, loading it etc but am hitting a problem with a pivot table.

VB.NET:
 ptCache = ObjExcelB.PivotCaches.Add(XlPivotTableSourceType.xlExternal, arData)

 ObjExcelB.ActiveSheet.PivotTableWizard XlPivotTableSourceType.xlDatabase, _
                 ObjExcelB.Sheets("Data").Range(Rstr), _
                 ObjExcelB.Sheets("PivotData").Range(Rstr), _
                 TableName:="PivotTable1")

                With ObjExcelB.Sheets("pivotData").PivotTables("PivotTable1")
                    .SmallGrid = False
[COLOR="Red"]                    .AddFields(RowFields:="CauseCode", ColumnFields:="Data", PageFields:="Responsibility")[/COLOR]
                    .PivotFields("Defects").Orientation = ObjExcelB.xlDataField
                    .ShowPages(PageField:="Responsibility")

It fails on adding fields to the table and other locations.
I have seached google, forums, MSDN etc. I have been told numerous times to record a new one in excel, then cut and paste.
Sigh. There must be info out there somewhere, a solution; some place.
 
Back
Top