title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Chart.SetElement method (Excel) |
vbaxl10.chm149175 |
|
|
0efff437-179b-fe16-118b-6f3cde49c5cf |
04/16/2019 |
medium |
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 | Specifies the chart element type. |
Nothing
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.
This example sets chart elements by using the various constant values to an active chart.
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.SetElement (msoElementChartTitleCenteredOverlay)
ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMinor)
ActiveChart.Walls.Select
Application.CommandBars("Clip Art").Visible = False
ActiveChart.SetElement (msoElementChartFloorShow)
[!includeSupport and feedback]