ShowAsValue Property

Microsoft Office Web Components Visual Basic

expression.ShowAsValue

expression    Required. An expression that returns a PivotAggregate object.

Example

This example displays the aggregate for the third member of the row field in a message box.

Sub GetTotal()

    Dim ptData
    Dim pmRowMem
    Dim pmColMem

    ' Set a variable to the PivotTable data.
    Set ptData = PivotTable1.ActiveData

    ' Set a variable to the third item contained in the field
    ' that has been added to the row axis.
    Set pmRowMem = ptData.RowAxis.Member.ChildMembers(2)

    ' In this example, there are no fields on the column axis.
    Set pmColMem = ptData.ColumnAxis.Member

    ' Display the value of the aggregate.
    MsgBox ptData.Cells(pmRowMem, pmColMem).Aggregates(0).ShowAsValue

End Sub