Name

Application.AddChartAutoFormat(Chart, Name, [Description])

Synopsis

Creates a new chart type based on an existing chart.

Argument

Setting

Chart

A chart object to get formatting from

Name

The name to add to the chart autoformat list

Description

A description of the chart type

The following code adds a custom chart type to Excel based on an existing chart in the current workbook:

Sub TestAddChartType(  )
    Application.AddChartAutoFormat Charts(1), _
      "new custom", "my description"
End Sub

To see the new chart type, select some data on a worksheet and choose Insert → Chart → Custom Types → User Defined.

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.