Creating Pivot Table in Excel File with Interop Assemblies
I'm trying to create a pivot table.
Actually, I'm creating one from a Table of an existing sheet. So I'm creating a pivot table named Activite, and then add the pivot fields,Libell in Row and 2 series of fields, namedNb P1, NB P2 as Data.
But the problem is that:
in the sheet of the pivottable, the 2 series have been added in the same colomn, so it does the sum of the two series.
And actually, I want the 2 series, displayed separetely.
Here is the code:
obook is an Microsoft.Office.Interop.Excel.workbook object
With (obook.Worksheets.Item("Feuil2").PivotTables("Activite"))
.SmallGrid = False
With .PivotFields("Libell")
.Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField
.Position = 1
End With
With .PivotFields("Nb P1")
.Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
.Position = 1
End With
With .PivotFields("Nb P2")
.Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
.Position = 2
End With
End With
Has someone ever had this problem?
help appreciated
david

