Reputation: 1
I'm trying to set the text field of a shape to the name of the layer it is on (Visio 2010). I should be able to set the formula to this:
=ThePage!Layers.Name[LayerMember]
but that doesn't work because LayerMember is a string and a shape can be on multiple layers, i.e., LayerMember = "3" if it is only on the 3rd layer but can be "3;2;5" if it is on three different layers. So, using LEFT(LayerMember, 1) gets the first value in the list but putting that in the index field of the above formula doesn't work either. Putting a static value in the index field works just fine but I want to be able to change the layer of a shape and have the text on the shape change to the layer name.
Using LEFT(LayerMember,1) returns a string. I can't find a way to convert the string value to a number to get the layer name value from the page's shapesheet.
I'm new at Visio but for some reason I can't figure this one out.
Upvotes: 0
Views: 3791
Reputation: 71
Layer is a property of shape, so try shpObj.Layer(1).Name this will give you the name of the first layer the shape is on. You will need to check shjObj.LayerCount to make sure that the shape actually is on a layer.
Upvotes: 1