Class DataLabel (Word 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 = ActiveDocument.Background.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

For Each

Here is an example of processing the DataLabel items in a collection.

Dim dtl As DataLabel
For Each dtl In ActiveDocument.Background.Chart.FullSeriesCollection.DataLabels()
	
Next dtl

Themes

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

Format with its procedures Format, NumberFormat, DataLabels.Format and DataLabels.NumberFormat
Formula with its procedures Formula, FormulaLocal, FormulaR1C1 and FormulaR1C1Local
Number with its procedures NumberFormatLinked, NumberFormatLocal, DataLabels.NumberFormatLinked and DataLabels.NumberFormatLocal
Display/Show with its procedures ShowBubbleSize, ShowLegendKey, ShowPercentage, ShowRange, DataLabels.ShowBubbleSize, DataLabels.ShowLegendKey, DataLabels.ShowPercentage and DataLabels.ShowRange

Methods

These are the main methods of the DataLabel class

Delete - Deletes the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Delete

Select - Selects the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Select

DataLabels.Delete - Deletes the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Delete

DataLabels.Select - Selects the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Select

Properties

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.AutoText = True

Caption returns or sets the data label text.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Caption =

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 = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Characters

Height gets or sets the height, in points, of the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Height =

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

ActiveDocument.Background.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.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Left =

Name returns the name of the object.

Dim strName As String
strName = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Name

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Orientation =

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Parent

Position returns or sets the position of the data label.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Position = xlLabelPositionAbove

ReadingOrder returns or sets an XlReadingOrder constant that represents the reading order for the specified object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ReadingOrder =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Separator =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Shadow = True

ShowCategoryName true to display the category name for the data labels on a chart. False to hide the category name.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowCategoryName = True

ShowSeriesName true to show the series name for the data labels on a chart. False to hide the series name.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowSeriesName = True

ShowValue true to display a specified chart's data label values. False to hide the values.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowValue = True

Text returns or sets the text for the specified object.

ActiveDocument.Background.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).

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Top =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.VerticalAlignment = xl3DBar

Width gets or sets the width, in points, of the object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Width =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.AutoText = True

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

Dim lngCount As Long
lngCount = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Count

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.HorizontalAlignment = xl3DBar

DataLabels.Name returns the name of the object.

Dim strName As String
strName = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Name

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Orientation =

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Parent

DataLabels.Position returns or sets the position of the data labels.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Position = xlLabelPositionAbove

DataLabels.ReadingOrder returns or sets an XlReadingOrder constant that represents the reading order for the specified object.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ReadingOrder =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Separator =

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.Shadow = True

DataLabels.ShowCategoryName true to display the category name for the data labels on a chart. False to hide the name.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowCategoryName = True

DataLabels.ShowSeriesName true to show the series name for the data labels on a chart. False to hide the name.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowSeriesName = True

DataLabels.ShowValue true to display the data label values for a specified chart. False to hide the values.

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.ShowValue = True

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

ActiveDocument.Background.Chart.FullSeriesCollection(1).DataLabels.VerticalAlignment = xl3DBar