Whose my parent?

Sorry David, no pictures this time. This is a very quick post.

I came across a Stack OverFlow question. The user had a shape that contained other shapes and wanted how to reference the parent shape.

The posted answer….

Although there nothing like “parent”, you can use shape id directly. You need to find the ID (NNN) of the parent shape (i.e. of the group shape), and then use it in the child shape using the syntax like this:


The ID of the shape can be found using drawing explorer window (it displays shapes with ids), or “Shape Name” button on the “Developer” tab, ID() shape sheet function on the group (parent) shape, or shape.ID property VBA code.

VBA Solution

In Visio VBA there is a Parent option. So, the answer could be

If VsoShp1 contains two subshapes, VsoShp2 and VsoShp3. You can find the Parent of VSOShp3 by using

Debug.Print VsoShp3.Parent

which will produce a reference to VsoShp1 and display “VsoShp1”. You can get the Shape Id by

Debug.Print VsoShp3.Parent.ID

John… Visio MVP in x-aisle

Published by johnvisiomvp

The original Visio MVP. I have worked with the Visio team since 1993