1

I have some defined shapes in a Visio 2010 stencil, and would like to set the layer depending on the value of a particular shape data field. I would like to do this within the shapesheet if at all possible, since my workplace is very limiting concerning the use of VisualBasic.

I can do the necessary look up to find a particular value, but need to translate this to the correct index in the page layers list.

Basically, I need to get the current index of a particular layer. For example, I know the name of the layer is "Remove" and need the index in ThePage!Layers so that I can set LayerMember accordingly. The index changes from page to page, so I need do this lookup in the context of the page after the shape has been dropped on the page.

How can I look up the index of an entry in ThePage!Layers, using the name of the layer as lookup index. A syntax like ThePage!Layers.Index["Remove"] doesn't work and I couldn't find any other information in the Microsoft documentation.

David Christie
  • 191
  • 1
  • 5

1 Answers1

0

It is possible! My method
i add to my shape 3 sections: User-definded cells, Shape Data, Layer Membership.
Add three new sections In Shape Data section i create one row, which contain Layer Name selector
User-definded cells section contain two rows:
1. User.L_List store list of all layers on page. I prepare this list use MS Excel In column A i fill row numbers, like as at this picture Prepare layers list in MS Excel
In cell B1 i place formula - Concatenate("ThePage!Layers.Name";A1)
In cell B2 i place formula - Concatenate(B1;"&Listsep()&ThePage!Layers.Name[";A2;"]") And pull down some rows as i need. Select bottom cell in column B and copy that value Paste this value in MS Visio's cell User.L_List
2. Next cell contain formula SETF(GetRef(LayerMember),LOOKUP(Prop.LayerName,User.L_List)),
which assign shape to layer according value in Prop.LayerName cell

Surrogate
  • 687
  • 7
  • 11