|Figure 1 - Worksheet with Charts and Text Boxes|
ExaminationAs my usual method for understanding the object model, I ran a small sub that simply assigned the worksheet, then examined the breakdown, focusing on the Shapes, where I knew the Charts could be found.
I expected to find either three shapes (the two Charts and the orange text box) or seven,
|Figure 2 - Shapes with the Worksheet as the Parent|
Instead, as shown above, there were five. That is because, driving down, I found there are 2 Shapes within Item2, which is "Chart 3".
|Figure 3 - Shapes with a Chart as the Parent|
Making the Discovery Useful
A Priori Knowledge
- Like a Chart object is a property of a Shape where the Type is msoChart, when Shape.Type = msoTextBox we must look into the DrawingObject property of the Shape contains the value shown in the Text Box.
- The value shown is in DrawingObject.Caption.