Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Application.WorkbookNewChart Event (Excel)

Occurs when a new chart is created in any open workbook.

Version Added: Excel 2010

expression .WorkbookNewChart(Wb, Ch)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Wb

Required

Workbook

The workbook.

Ch

Required

Chart

The new chart.

Return Value

Nothing

The WorkbookNewChart event occurs when 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 WorkbookNewChart 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.

The following code example displays a message box when a new chart is added to a workbook.

Private Sub App_NewChart(ByVal Wb As Workbook, _ 
 ByVal Ch As Chart) 
 MsgBox ("A new chart was added to: " & Wb.Name & " of type: " & Ch.Type) 
End Sub
Show:
© 2015 Microsoft