Microsoft Office Tutorials and References
In Depth Information
USING THE MOUSEOVER EVENT
ElementID: A number that corresponds to the chart element at
coordinates X and Y — for example, the value 3 corresponds to a Series. VBA
also recognizes the built-in constant, xlSeries , which has a value of 3.
arg1: Additional information about the element at coordinates X and Y.
If ElementID is the code for a Series, then arg1 returns a number that
corresponds to the specific series number.
arg2: Still more information about the element at coordinates X and Y.
If ElementID is the code for a Series, then arg2 returns the specific data
point within the series.
Depending on the value of ElementID , the arg1 and arg2 arguments may
not be used. For example, if the Chart Area is clicked, ElementID returns 2
( xlChartArea ), and arg1 and arg2 are not relevant.
The chart in this example has only one series, so the Chart_MouseDown procedure
focuses on arg2 , which will have a value of 1, 2, or 3. A Select Case structure
activates the appropriate sheet, based on the value of arg2 .
USING THE MOUSEOVER EVENT
A common charting question deals with modifying chart tips. A chart tip is the small
message that appears next to the mouse pointer when you move the mouse over a
chart. The chart tip displays the chart element name and (for series) the value of the
data point. The Chart object model does not expose these chart tips, so there is no
way to modify them.
To turn chart tips on or off, choose ToolsOptions. Click the Chart tab and
select or unselect the two check boxes in the Chart tips section.
This section describes an alternative to chart tips. Figure 16-20 shows a column
chart that uses the MouseOver event. When the mouse pointer is positioned over a
column, the text box (a shape object) in the upper left displays information about
the data point. The information is stored in a range and can consist of anything you
like.
Search JabSto ::




Custom Search