Class LegendEntry (Word VBA)

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

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)

LegendEntry class variables can be set using the LegendEntries.Item procedure.

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

Delete

Deletes the object.

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

Font

Returns the font of the specified object.

Dim cftFont As ChartFont
Set cftFont = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Font

Format

Returns the line, fill, and effect formatting for the object.

Dim cftFormatted As ChartFormat
Set cftFormatted = ActiveDocument.Background.Chart.Legend.LegendEntries(1).Format

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.

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 .Chart.Legend.LegendEntries(1).LegendKey _ 
 .MarkerStyle = xlMarkerStyleTriangle 
 End If 
End With

Select

Selects the object.

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

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