Class DataLabel (PowerPoint VBA)

The class DataLabel represents the data label on a chart point or trendline.

The main procedures of class DataLabel are Delete, Select, DataLabels.Delete and DataLabels.Select

Set

To use a DataLabel class variable it first needs to be instantiated, for example

Dim dtl as DataLabel
Set dtl = ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels()

The following procedures can be used to set variables of type DataLabel: DataLabels.Item, Point.DataLabel, Series.DataLabels, Trendline.DataLabel and Series.DataLabels

Themes

Some procedures in this class have been grouped together in themes and are described on separate theme pages

Name with its procedures Caption, Name and DataLabels.Name
Format with its procedures Format, Height, Width and DataLabels.Format
Formula with its procedures Formula, FormulaLocal, FormulaR1C1 and FormulaR1C1Local
Number with its procedures NumberFormat, NumberFormatLinked, NumberFormatLocal, DataLabels.NumberFormat, DataLabels.NumberFormatLinked and DataLabels.NumberFormatLocal
Sort/Order with its procedures ReadingOrder and DataLabels.ReadingOrder
Display/Show with its procedures ShowBubbleSize, ShowCategoryName, ShowLegendKey, ShowPercentage, ShowRange, ShowSeriesName, DataLabels.ShowBubbleSize, DataLabels.ShowCategoryName, DataLabels.ShowLegendKey, DataLabels.ShowPercentage, DataLabels.ShowRange and DataLabels.ShowSeriesName
Value with its procedures ShowValue and DataLabels.ShowValue

Methods

These are the main methods of the DataLabel class

Delete - Deletes the object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Delete

Select - Selects the object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Select

DataLabels.Delete - Deletes the object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Delete

DataLabels.Select - Selects the object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Select

Other Methods

SetProperty -

Dim strId As String: strId = 
ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.SetProperty Id:=strId, Value:=

DataLabels.SetProperty -

Dim strId As String: strId = 
ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.SetProperty Id:=strId, Value:=

Properties

AutoText true if the object automatically generates appropriate text based on context.

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).DataLabels.AutoText = True

Characters returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Dim ccsCharacters As ChartCharacters
Set ccsCharacters = ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Characters

HorizontalAlignment returns or sets the horizontal alignment for the specified object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.HorizontalAlignment = xl3DBar

Left returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Left =

Orientation returns or sets the text orientation. Read/write Long.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Orientation =

Parent returns the parent for the specified object. Read-only object.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Parent

Position returns or sets the position of the data label.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Position = xlLabelPositionAbove

Separator returns or sets the separator used for the data labels on a chart. Read/write Variant.

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).DataLabels.Separator = ";"

Shadow returns or sets a value that indicates whether the object has a shadow.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Shadow = True

Text returns or sets the text for the specified object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Text =

Top returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart).

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Top =

VerticalAlignment returns or sets the vertical alignment of the specified object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.VerticalAlignment = xl3DBar

DataLabels.AutoText true if all objects in the collection automatically generate appropriate text based on context.

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).DataLabels.AutoText = True

DataLabels.Count returns the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Count

DataLabels.HorizontalAlignment returns or sets the horizontal alignment for the specified object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.HorizontalAlignment = xl3DBar

DataLabels.Orientation returns or sets the text orientation. Read/write Long.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Orientation =

DataLabels.Parent returns the parent for the specified object. Read-only object.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Parent

DataLabels.Position returns a value from the XlDataLabelPosition enumeration indicating the position of the data labels in a chart.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Position = xlLabelPositionAbove

DataLabels.Separator sets or returns the separator for the data labels on a chart. Read/write Variant.

ActivePresentation.Slides(1).Shapes(1).Chart.FullSeriesCollection(1).DataLabels.Separator = ";"

DataLabels.Shadow returns or sets a value that indicates whether the object has a shadow.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.Shadow = True

DataLabels.VerticalAlignment returns or sets the vertical alignment of the specified object.

ActiveWindow.RangeFromPoint.Chart.FullSeriesCollection(1).DataLabels.VerticalAlignment = xl3DBar