Microsoft Office Tutorials and References
In Depth Information
USING THE MOUSEDOWN EVENT
Figure 16-19: Monitoring the MouseDown event makes this chart function
as a clickable menu.
The Chart_MouseDown event procedure follows. This macro is executed
whenever a mouse button is clicked on the chart.
Private Sub Chart_MouseDown(ByVal Button As Long, _
ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
Dim ElementID As Long
Dim arg1 As Long, arg2 As Long
GetChartElement X, Y, ElementID, arg1, arg2
If ElementID = xlSeries Then
Select Case arg2
Case 1
Sheets(“North”).Activate
Case 2
Sheets(“South”).Activate
Case 3
Sheets(“West”).Activate
End Select
End If
End Sub
Notice that the procedure takes several arguments, which are used to determine
what was clicked. The arguments important to this procedure are the X and Y
variables. These represent the horizontal and vertical coordinates of the mouse pointer
when the mouse was clicked. The GetChartElement statement uses these
coordinates and returns three pieces of information, stored in variables:
Search JabSto ::




Custom Search