Workbook.NewChart event (Excel)
Occurs when a new chart is created in the workbook.
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 on 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기