Workbook.NewChart Event (Excel)

Occurs when a new chart is created in the workbook.

Version Information

Version Added: Excel 2010

Syntax

expression .NewChart(Ch )

expression A variable that returns a Workbook object.

Parameters

Name

Required/Optional

Data Type

Description

Ch

Required

Chart

The new chart.

Return Value

Nothing

Remarks

The NewChart event occurs whenever a new chart is inserted or pasted in a worksheet, a chart sheet, or other sheet types. If multiple charts are inserted or pasted, the event will occur for each chart in the order they are inserted or pasted. If a chart object or chart sheet is moved from one location to another, the event will not occur. However, if the chart is moved between a chart object and a chart sheet, the event will occur because a new chart must be created.

The NewChart event will not occur in the following scenarios: copying or pasting a chart sheet, changing a chart type, changing a chart data source, undoing or redoing inserting or pasting a chart, and loading a workbook that contains a chart.

Example

This example displays a message box when a new chart is added to the workbook.

Private Sub Workbook_NewChart(ByVal Ch As Chart) 
 MsgBox ("A new chart of the following chart type was added: " & Ch.ChartType) 
End Sub

See Also

Concepts

Workbook Object Members

Workbook Object