XLPivot .SubTotals

Hi,

In excel vba - i can turn subtotals off for a field in a pivot table..

e.g. below..

For Each pt In ActiveSheet.PivotTables
For Each pf In pt.PivotFields
'First, set index 1 (Automatic) to True,
'so all other values are set to False
pf.Subtotals(1) = True
pf.Subtotals(1) = False
Next pf
Next pt

but in NAV - ( First 2 lines work fine - but the Subtotals line doesn't compile.. ( A variable is expected?)


xlPvtField := xlPivot.PivotFields('Product');
xlPvtField.Orientation := 1; //xlRowField


xlPvtField.Subtotals(1) := false ;

Any ideas ?

.Subtotals returns an array with no params , but the 1 is the Automatic totals.

Other option i have it to set the whole subtotals array... like the Excel VBA below.. \


.Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)

but not sure how to make the Array...


FOR i := 1 TO 12 DO BEGIN
ArrayFalse := FALSE;
END;

xlPvtField := xlPivot.PivotFields('Product');
xlPvtField.Orientation := 1;
xlPvtField.Subtotals := ArrayFalse;

That also doesnt compile... Array Dimensions must be identical...

Any ideas ?
Thanks,
Steve

Answers

Sign In or Register to comment.