Microsoft Office Tutorials and References
In Depth Information
The Chart Object Model
These objects, in turn, can contain other objects. Consider the SeriesCollection ,
which is a collection of all Series objects in the chart. A Series object contains the
Now consider the Points collection. Each Point object contains the following
Assume that you want to write code to set the text of a data label to January .
Furthermore, assume that this data label belongs to the first point of the first series
of the first chart in the first worksheet of the active workbook. Your VBA statement
needs to traverse this object hierarchy and set the Text property of the appropriate
Here’s the statement that does the job (this is a single statement that spans
.Points(1).DataLabel.Text = “January”
Actually, it’s even a bit more complex. Setting the Text property for a
DataLabel object will generate an error if the HasDataLabel property of
the Point object is False (its default setting).