CalculatedMembers.Add Method

Adds a calculated field or calculated item to a PivotTable.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Add ( _
    Name As String, _
    Formula As String, _
    SolveOrder As Object, _
    Type As Object _
) As CalculatedMember
'Usage
Dim instance As CalculatedMembers
Dim Name As String
Dim Formula As String
Dim SolveOrder As Object
Dim Type As Object
Dim returnValue As CalculatedMember

returnValue = instance.Add(Name, Formula, _
    SolveOrder, Type)
CalculatedMember Add(
    string Name,
    string Formula,
    Object SolveOrder,
    Object Type
)

Parameters

  • Name
    Type: System.String

    Required String. The name of the calculated member.

  • Formula
    Type: System.String

    Required String. The formula of the calculated member.

  • SolveOrder
    Type: System.Object

    Optional Object. The solve order for the calculated member.

  • Type
    Type: System.Object

    Optional Object. The type of calculated member.

Return Value

Type: Microsoft.Office.Interop.Excel.CalculatedMember

Remarks

The Formula argument must have a valid MDX (multidimensional expression) syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider and the Type argument has to be defined.

If you set the Type argument of this method to xlCalculatedSet, then you must call the AddSet method to make the new field set visible in the PivotTable.

See Also

Reference

CalculatedMembers Interface

CalculatedMembers Members

Microsoft.Office.Interop.Excel Namespace