visioshapesheet

How do I refer the shape's data from sub-shape of Visio custom shape


I'm trying to design a custom shape in Visio.

My structure is like this: In the "Edit Master" page I have some rectangles, I called my shape "MyDay", so that's its document's name in the Master Explorer and in the edit window.

My problem is, that I can't find a way to refer the shape's date itself (like =MyDay!Name() or =MyDay!User.MyUserField) from one of my sub-shapes.

If I add a reference to ThePage and drop the master on a page - I adds that property to the page itself - again - no reference to the main shape from its sub-shapes.

I know there is no "Parent" property in ShapeSheet formulas (only on VBA), but I'm really trying to find a way to refer it using fields or formulas, without the need to write and run VBA code.

Many appreciations for any help!


Solution

  • Paul is correct, but I will add that it is normally expected that a Master contains only one shape, but that can be a group shape that contains other shapes. Therefore, a formula in a sub-shape can refer to any shape in that group, including the top level group shape, using the Sheet.n syntax. When an instance of the master shape is dropped onto a page, then Visio will automatically update the n ID to the actual shape ID in the page. The shape ID has to be unique within the shapes collection that it is part of, so the top-level group shape needs to be assigned a new unique ID, but the sub-shapes do not because they already have an ID that is unique within the shapes collection that they are part of.