Class Legend (Word VBA)

The class Legend represents the legend in a chart. Each chart can have only one legend.

The main procedures of class Legend are Delete and Select


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

Dim lgn as Legend
Set lgn = ActiveDocument.Background.Chart.Legend

Legend class variables can be set using the Chart.Legend procedure.


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

Format with its procedures Format and IncludeInLayout


These are the main methods of the Legend class

Delete - Deletes the object.


Select - Selects the object.



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

ActiveDocument.Background.Chart.Legend.Height =

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

ActiveDocument.Background.Chart.Legend.Left =

Name returns the name of the object.

Dim strName As String
strName = ActiveDocument.Background.Chart.Legend.Name

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

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

Position returns or sets the position of the legend on the chart.

ActiveDocument.Background.Chart.Legend.Position = xlLegendPositionBottom

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

ActiveDocument.Background.Chart.Legend.Shadow = True

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.Legend.Top =

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

ActiveDocument.Background.Chart.Legend.Width =