expression Required. An expression that returns a ChartSpace object.
The ChSelectionCollection object contains all currently selected objects in a chart. The first item in the collection is the primary selection. Additional items are secondary selections. The number of items in this collection can never be zero because the object returned by
ChartSpace1.SelectionCollection(0) is the same object as that returned by the Selection property of the ChartSpace object. The first object in the collection can be any chart object selection, but all subsequent objects must be points. If the Selection property is null and there are no secondary selections, the SelectionCollection will equal 0.
Multiple items cannot be selected in the user interface of the Chart component. Items must be added to or removed from a selection programmatically. To capture multiple selections when a user clicks on a chart, you must monitor the mouse move and mouse button events and identify the items being selected using the RangeFromPoint method of the ChartSpace object. To prevent the built-in selection handling behavior of the Chart component from interfering with programmatic tracking of multiple selections, you must make sure that the AllowUISelection property of the ChartSpace object is set to False.
The following example shows how to use the SelectionCollection property to iterate through a set of selected data points in a chart.
Dim intCount Dim intIndex With ChartSpace1.Charts(0).SeriesCollection(0) .Points(0).Select2 1 .Points(1).Select2 1 .Points(2).Select2 1 .Points(3).Select2 1 .Points(4).Select2 1 End With intCount = ChartSpace1.SelectionCollection.Count For intIndex = 0 To intCount - 1 MsgBox "Item(" & iIndex & ") = " & TypeName(ChartSpace1.SelectionCollection.Item(intIndex)) Next