Chart.ApplyDataLabels method (Project)
Applies data labels to all the series in a chart.
Syntax
expression.ApplyDataLabels (Type, IMsoLegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)
expression A variable that represents a Chart object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Type | Optional | Office.XlDataLabelsType | The type of data label to apply. The default value is xlDataLabelsShowValue. |
IMsoLegendKey | Optional | Variant | True to show the legend key next to the point. The default value is False. |
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content. |
HasLeaderLines | Optional | Variant | True if the series has leader lines. |
ShowSeriesName | Optional | Variant | True to enable the series name for the data label. False to disable the series name. |
ShowCategoryName | Optional | Variant | True to enable the category name for the data label. False to disable the category name. |
ShowValue | Optional | Variant | True to enable the value for the data label. False to disable the value.If the Type parameter is not specified, ShowValue is assumed to be True. |
ShowPercentage | Optional | Variant | True to enable the percentage for the data label. False to disable the percentage. |
ShowBubbleSize | Optional | Variant | True to enable the bubble size for the data label. False to disable the bubble size. |
Separator | Optional | Variant | The separator for the data label. |
Return value
Nothing
Example
The following example applies data labels to each data point.
Sub SetDataLabels()
Dim chartShape As Shape
Dim reportName As String
reportName = "Simple scalar chart"
Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
chartShape.Chart.ApplyDataLabels
End Sub
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.