Format related procedures in class Chart (PowerPoint VBA)

This page presents procedures from class Chart related to the theme Format: ApplyLayout, ChartColor, ChartStyle, ClearToMatchColorStyle, ClearToMatchStyle, Format, HeightPercent and PlotVisibleOnly

ApplyLayout

Applies the layouts shown in the Ribbon.

When you use a layout on the current chart type, a number from 1 to 10 is applied to the chart type. You can also apply the layout of one chart type on another chart type. For example, you can apply the layouts that are available from a line chart to a column chart. The layout adds only chart elements that are available for that particular chart type.

Syntax : expression.ApplyLayout (Layout, ChartType)

Dim lngLayout As Long: lngLayout = 
ActiveWindow.RangeFromPoint.Chart.ApplyLayout Layout:=lngLayout

Arguments

The following argument is required

Layout (Long) - The type of layout. The type of layout is denoted by a number from 1 to 10.

The following argument is optional

ChartType (Office.XlChartType) - An XlChartType constant that represents the type of chart.

ChartColor

Returns or sets an integer that represents the color scheme for the chart.

Chart color schemes are numbered from 1 to 17; the setting of this property corresponds to the color schemes shown on the Change Colors gallery on the Chart Tools Design ribbon tab.

ActiveWindow.RangeFromPoint.Chart.ChartColor =

ChartStyle

Returns or sets the chart style for the chart.

You can use a number from 1 to 48 to set the chart style.

ActiveWindow.RangeFromPoint.Chart.ChartStyle =

ClearToMatchColorStyle

Clears all colors on the specified chart that do not follow the color style applied to the chart.

Use this method to reset all the chart color formatting to the color style applied to the chart.

ActiveWindow.RangeFromPoint.Chart.ClearToMatchColorStyle

ClearToMatchStyle

Clears the chart elements formatting to automatic.

Use this method to reset the chart elements formatting to automatic. If you use this method on a chart, all formatting (including overrides) will be reset.

ActiveWindow.RangeFromPoint.Chart.ClearToMatchStyle

Format

Returns the ChartFormat object.

The ChartFormat object contains the line, fill, and effect formatting for the chart area.

Dim cftFormatted As ChartFormat
Set cftFormatted = ActiveWindow.RangeFromPoint.Chart.Format

HeightPercent

Returns or sets the height of a 3D chart as a percentage of the chart width (from 5 through 500 percent).

ActivePresentation.Slides(1).Shapes(1).Chart.HeightPercent = 90

PlotVisibleOnly

True if only visible cells are plotted. False if both visible and hidden cells are plotted.

ActivePresentation.Slides(1).Shapes(1).Chart.PlotVisibleOnly = True