Class LegendEntry (Word VBA)

The class LegendEntry represents a legend entry in a chart legend.

The main procedures of class LegendEntry are Delete and Select

Set

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

Dim lgne as LegendEntry
Set lgne = ActiveDocument.Background.Chart.Legend.LegendEntries(Index:=1)

The following procedures can be used to set variables of type LegendEntry: Legend.LegendEntries and LegendEntries.Item

For Each

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

Dim lgne As LegendEntry
For Each lgne In ActiveDocument.Background.Chart.Legend.LegendEntries()
	
Next lgne

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Format with its procedures Font and Format

Methods

These are the main methods of the LegendEntry class

Delete - Deletes the object.

ActiveDocument.Background.Chart.Legend.LegendEntries(1).Delete

Select - Selects the object.

ActiveDocument.Background.Chart.Legend.LegendEntries(1).Select

Properties

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

Dim lngCount As Long
lngCount = ActiveDocument.Background.Chart.Legend.LegendEntries.Count

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.Legend.LegendEntries.Parent

Height returns the height, in points, of the object.

Dim dblHeight As Double
dblHeight = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Height

Index returns the index number of the object within the collection of similar objects.

Dim lngIndex As Long
lngIndex = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Index

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

Dim dblLeft As Double
dblLeft = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Left

LegendKey returns the legend key that is associated with the entry.

Dim lkyLegendKey As LegendKey
Set lkyLegendKey = ActiveDocument.Background.Chart.Legend.LegendEntries(1).LegendKey

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Parent

Top returns 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).

Dim dblTop As Double
dblTop = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Top

Width returns the width, in points, of the object.

Dim dblWidth As Double
dblWidth = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Width