Data related procedures in class Chart (PowerPoint VBA)

This page presents procedures from class Chart related to the theme Data: ApplyDataLabels, ChartData, DataTable, HasDataTable and SetSourceData


Applies data labels to all the series in a chart.

Syntax : expression.ApplyDataLabels (Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)



The following arguments are optional

Type (XlDataLabelsType) - One of the enumeration values that specifies the type of data label to apply. Can be one of the xlDataLabelsType constants.

Possible Values are

xlDataLabelsShowBubbleSizes Show the size of the bubble in reference to the absolute value.
xlDataLabelsShowLabel The category for the point.
xlDataLabelsShowLabelAndPercent The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.
xlDataLabelsShowNone No data labels.
xlDataLabelsShowPercent The percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowValue The default value for the point (assumed if this argument is not specified).

LegendKey (String) - True to show the legend key next to the point. The default is False.

AutoText (Boolean) - True if the object automatically generates appropriate text based on content.

HasLeaderLines (Boolean) - For the Chart and Series objects, True if the series has leader lines.

ShowSeriesName (Boolean) - True to enable the series name for the data label; otherwise, False.

ShowCategoryName (Boolean) - True to enable the category name for the data label; otherwise, False.

ShowValue (Boolean) - True to enable the value for the data label; otherwise, False.

ShowPercentage (Boolean) - True to enable the percentage for the data label; otherwise, False.

ShowBubbleSize (Boolean) - True to enable the bubble size for the data label; otherwise, False.

Separator (String) - The separator for the data label.


Returns information about the linked or embedded data associated with a chart.

Dim cdaChartData As ChartData
Set cdaChartData = ActivePresentation.Slides(1).Shapes(1).Chart.ChartData


Returns the chart data table.

Dim dteDataTable As DataTable
Set dteDataTable = ActivePresentation.Slides(1).Shapes(1).Chart.DataTable


True if the chart has a data table.

ActivePresentation.Slides(1).Shapes(1).Chart.HasDataTable = True


Sets the source data range for the chart.

Syntax : expression.SetSourceData (Source, PlotBy)

ActivePresentation.Slides(1).Shapes(1).Chart.SetSourceData Source:="='Sheet1'!$A$1:$D$5"


The following argument is required

Source (String) - The address of the chart data range that contains the source data.

The following argument is optional

PlotBy (XlRowCol) - Specifies the way the data will be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Possible Values are xlColumns - The data series is in a row, xlRows - The data series is in a column.