TextRange2.InsertChartField method (Office)

Inserts a field into the body of a data label in a chart.

This method applies only to data labels in a chart. Calling this method on any other kind of TextRange2 object will raise a run-time error.

Syntax

expression.InsertChartField (ChartFieldType, Formula, Position)

expression A variable that represents a TextRange2 object.

Parameters

Name Required/Optional Data type Description
ChartFieldType Required MsoChartFieldType Specifies the type of chart field to insert into a data label.
Formula Optional String Specifies a cell (or range) if the msoChartFieldFormula constant is passed in for the ChartFieldType parameter.
Position Optional Integer Specifies the character position where the chart field is inserted. The default is to append the field to the end of the text. If the position value is out of range, the default is used.

Return value

TextRange2

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.