Comments:
When you put the mouse over a point in a series on an Excel chart what is displayed is the value on the x and y axis. For example you may have the date on the x axis and the price on the y axis and this is what is displayed when you hover the mouse over the particular point on the chart.
The way you would access this information programmatically would be to drill down through all the objects in Excel. This is tricky because some of the objects are containers which contain other objects. The object you want to access is called a DataLabel.
If you type DataLabel in the VBA editor then select it and then press F1 you will go to the help section which explains how to call it and provides you an example of some code. The code from the help is:
Worksheets(1).ChartObjects(1).Chart _ .SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"
This code sets the format for the fifth data label in the first series on the chart to have 3 decimal points. If you want to put the data label into a string variable the code would be:
Dim sString as String
With Charts("chart1") With .SeriesCollection(1).Points(2) .HasDataLabel = True sString =.DataLabel.Text End With End With
Hope this helps.
|