Chart events

 1999-08-21    Events    0    190

Events for the chart object occurs when the user activates or changes a chart. Events in charts are activated by default, but can be deactivated by a macro. To display the event procedures for a chart you use the Visual Basic editor. Select the desired project in the Project-window and activate the chart object you want by doubleclicking it. Any event procedures in the chart will now be displayed in the Code-window on the right side of the screen. You can create a new event procedure by selecting Chart in the Object dropdown, and then select an event in the Procedure dropdown.
Macros can be attached to the following events in a chart:

Activate
BeforeDoubleClick
BeforeRightClick
Calculate
Deactivate
DragOver
DragPlot
MouseDown
MouseMove
MouseUp
Resize
Select
SeriesChange
This example eventmacro will prevent the user from selecting and editing objects in a chart, the procedure must be written in the charts own module sheet, e.g. Chart1:

Private Sub Chart_Select(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long)
    ActiveChart.Deselect
End Sub