Friday 18 January 2013

VB.NET - Excel - Pivot - how to remove subtotals

Dim ptTable As Excel.PivotTable = osheet.PivotTables.Add(PivotCache:=ptCache, TableDestination:=xlRange, TableName:="SomeName")
Dim ptColumn As Excel.PivotField = ptTable.PivotFields("Columm Name")
Dim ptRow As Excel.PivotField = ptTable.PivotFields("RowName")

ptTable.ColumnGrand = True
ptTable.RowGrand = True
For Each ptRow In ptTable.PivotFields

    Try
    ptRow.Subtotals(1) = True
    ptRow.Subtotals(1) = False
    Catch ex As Exception

    End Try

Next ptRow

No comments:

Post a Comment