Chart.SetElement method (Word)

Sets chart elements on a chart. Read/write MsoChartElementType .


expression. SetElement( _Element_ )

expression A variable that represents a 'Chart' object.


Name Required/Optional Data type Description
Element Required MsoChartElementType One of the enumeration values that specifies the chart element type.


For charts, the following commands in the Layout tab correspond to the SetElement method:

  • Everything in the Labels group.

  • Everything in the Axes group.

  • Everything in the Analysis group.

  • PlotArea, Chart Wall, and Chart Floor buttons.

MsoChartElementType is an enumeration of constants that refer to all of the above commands.


The following example sets chart elements by using the various constant values to an active chart.

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart 
 ' Select the major gridlines on the value axis. 
 .SetElement msoElementChartTitleCenteredOverlay 
 .SetElement msoElementPrimaryCategoryGridLinesMinor 
 ' Select the walls. 
 .SetElement msoElementChartFloorShow 
 End With 
 End If 
End With 

See also

Chart Object