Word VBA, Shape Index
One of the things you need to know when working with shapes in VBA for word, is the shape index. Shape object are referenced through the Shapes and InlineShapes collections. In order for this to be done you must know the shape index. Shapes are indexed starting from the index “1”. Shapes fall into two main categories:
- Inline Shapes
- Floating Shapes
I have covered this topic in the article below:
A shape can be of many different types:
The type of shape does not affect its indexing. I will explain how shapes are indexed using examples.
Assume we have the following 3 floating shapes in our document. The first shape is a picture, the second is a chart and the third is again a picture:
The shape indices can be seen in the table below.
In the figure below you can see another word document. In this document there are floating and inline shapes. The chart has been changed to inline. Two text boxes have been added, the first is inline while the second is floating. Also at the end of the document there is a floating picture:
|2||Inline Shape||Text box||
|3||Floating Shape||Text box||