How to change Visio 2010 Shape Label inside the shape sheet
I am wondering if there is a way to change the t开发者_开发问答ext displayed below a shape using a value entered into the user defined shape data. Basically something like:
shape.TextBelowShapeImage = Prop.Name
It would be nice if this shape property were somewhere in the shape sheet.
Thank you for any help.
Wayne E. Pfeffer
You can easily accomplish this by using Fields. The key is to use the AddCustomFieldU method on the shapes Characters object.
Assume you have a shape with a property having a label of "FOO" with value "BAR". (The property is stored in a named row - in this case "Prop.Row_1" which is only visible in the ShapeSheet for the shape.
Dim vsoCharacters2 As Visio.Characters
Set vsoCharacters2 = myshape.Characters
vsoCharacters2.Begin = 0
vsoCharacters2.End = 0
vsoCharacters2.AddCustomFieldU "Prop.Row_1", visFmtNumGenNoUnits
After this code is run, the text of the shape will appear as "BAR"
精彩评论