Name

chart.GetChartElement(x, y, ElementID, Arg1, Arg2)

Synopsis

Gets information about the chart object at specific screen coordinates.

Argument

Settings

x

The x-coordinate of the object.

y

The y-coordinate of the object.

ElementID

An xlChartItem constant identifying the type of object at (x, y). See Table 16-1.

Arg1

Information about the object. See Table 16-1.

Arg2

Information about the object. See Table 16-1.

The x and y arguments are input arguments; ElementID, Arg1, and Arg2 are output arguments. The meaning of the output arguments varies based on the type of object (x, y); Table 16-1 describes those returned values.

Table 16-1. Meaning of GetChartElement output arguments

If ElementID is...

then Arg1 is...

and Arg2 is...

xlAxis, xlAxisTitle, xlDisplayUnitLabel, xlMajorGridlines, or xlMinorGridlines

xlAxisGroup

xlAxisType

xlPivotChartDropZone

xlPivotFieldOrientation

Not set

xlPivotChartFieldButton

xlPivotFieldOrientation

The index of the column in the PivotFields collection of the item

xlDownBars, xlDropLines, xlHiLoLines, xlRadarAxisLabels, xlUpBars

The index of the group within the ChartGroups collection

Not set

xlChartArea, xlChartTitle, xlCorners, xlDataTable, xlFloor, xlLegend, xlNothing, xlPlotArea, or xlWalls

Not set

Not set

xlDataLabel or xlSeries

The index of the series in the SeriesCollection of the chart

The index of the point in the Points collection of the series

xlErrorBars, xlLegendEntry, xlLegendKey, xlXErrorBars ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.