The Chart_Select procedure listed next is executed whenever an item on the chart is selected:
Private Sub Chart_Select(ByVal ElementID As Long, _
ByVal Arg1 As Long, ByVal Arg2 As Long)
Select Case ElementID
Case xlChartArea: Id = "ChartArea"
Case xlChartTitle: Id = "ChartTitle"
Case xlPlotArea: Id = "PlotArea"
Case xlLegend: Id = "Legend"
Case xlFloor: Id = "Floor"
Case xlWalls: Id = "Walls"
Case xlCorners: Id = "Corners"
Case xlDataTable: Id = "DataTable"
Case xlSeries: Id = "Series"
Case xlDataLabel: Id = "DataLabel"
Case xlTrendline: Id = "Trendline"
Case xlErrorBars: Id = "ErrorBars"
Case xlXErrorBars: Id = "XErrorBars"
Case xlYErrorBars: Id = "YErrorBars"
Case xlLegendEntry: Id = "LegendEntry"
Case xlLegendKey: Id = "LegendKey"
Case xlAxis: Id = "Axis"
Case xlMajorGridlines: Id = "MajorGridlines"
Case xlMinorGridlines: Id = "MinorGridlines"
Case xlAxisTitle: Id = "AxisTitle"
Case xlUpBars: Id = "UpBars"
Case xlDownBars: Id = "DownBars"
Case xlSeriesLines: Id = "SeriesLines"
Case xlHiLoLines: Id = "HiLoLines"
Case xlDropLines: Id = "DropLines"
Case xlRadarAxisLabels: Id = "RadarAxisLabels"
Case xlShape: Id = "Shape"
Case xlNothing: Id = "Nothing"
Case Else: Id = "Some unknown thing"
End Select
MsgBox "Selection type:" & Id
End Sub
Related examples in the same category