1

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!

Kazi
  • 381
  • 2
  • 13
Offer
  • 59
  • 1
  • 2
  • 14

2 Answers2

3

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.

David Parker
  • 509
  • 2
  • 7
1

You need to find the parent shape's Sheet reference number (select it and then ribbon Developer -> Shape Name -> Shape). This will be something like Sheet.6.

Use this reference in your formula e.g.

Sheet.6!User.MyUserField
Paul Herber
  • 1,150
  • 1
  • 7
  • 12
  • Dear @Paul, Thanks for looking into my issue. My problem with your approach is that it must be done manually, so there is no way for me to refer (in the master design) the main shape from the sub-shape so it will always stay connected, unless in every intense of my shape I'll re-look for its new 'parent' shape name. Isn't it? – Offer Sep 27 '21 at 08:03
  • No, if you are creating a master shape then you do the edit in that master shape and when you use the shape in a diagram that reference gets updated automatically. Just seen David's response. – Paul Herber Sep 27 '21 at 09:24