Microsoft Office Tutorials and References
In Depth Information
Understanding Chart Events
Figure 18-14: This chart serves as a clickable image map.
In addition, each of the other worksheets contains a button that executes the ReturnToMain
macro that reactivates the Main sheet.
The complete listing of Module1 follows:
Dim SummaryChart As New EmbChartClass
Sub CheckBox1_Click()
If Worksheets(“Main”).CheckBoxes(“Check Box 1”) = xlOn Then
‘Enable chart events
Range(“A1”).Select
Set SummaryChart.myChartClass = _
Worksheets(1).ChartObjects(1).Chart
Else
‘Disable chart events
Set SummaryChart.myChartClass = Nothing
Range(“A1”).Select
End If
End Sub
Sub ReturnToMain()
‘ Called by worksheet button
Sheets(“Main”).Activate
End Sub
The first instruction declares a new object variable SummaryChart to be of type EmbChart
Class — which, as you recall, is the name of the class module. When the user clicks the Enable
Chart Events button, the embedded chart is assigned to the SummaryChart object, which, in
effect, enables the events for the chart. The contents of the class module for EmbChartClass
follow:
 
Search JabSto ::




Custom Search