Legend shape - How to change description name

Started by Bogardo, March 28, 2012, 02:57:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bogardo

Hello all,

I just put in a code in my custom made shapes so that the legend shape would recognize them. (User.visLegendShape, value =2).
The name the legend displays under Description is not the name I gave to the custom made shape.
I tried to change it with the following code:

Sub ChangeName()
Dim stn As Visio.Document
Set stn = Visio.Documents("Stencil.vss")
Dim mst As Visio.Master
For Each mst In stn.Masters
mst.NameU = mst.Name
Next
End Sub


I opened the stencil (red star next to it) and run the code without effect. It still shows a number after the name. Any ideas?
Is there a way to have bigger symbols in the legend?

Paul Herber

If the shapes are already on your drawing then you need to do the name updte on the document stencil, i.e. the masters already within the document.
Here is a page showing how to do this:
http://www.visguy.com/2008/02/25/edit-visio-masters-programmaticallythe-right-way/

Do your renaming within a loop of all the masters.
P.S. add an error trap around the rename just in case it fails.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Bogardo

Quote from: Paul Herber on March 28, 2012, 03:12:24 PM
If the shapes are already on your drawing then you need to do the name updte on the document stencil, i.e. the masters already within the document.
Here is a page showing how to do this:
http://www.visguy.com/2008/02/25/edit-visio-masters-programmaticallythe-right-way/

Do your renaming within a loop of all the masters.
P.S. add an error trap around the rename just in case it fails.
I don'get it. I did as shown in your link but nothing changes. Maybe I don't fully understand it, I'm quiet new in this stuff you know.
A step by step guide would do the trick I guess. Below an image of the problem:
The shape I dragged from the stencil into the drawing area is present in the legend  but the names aren't the same and definitely not "RQ60 AUMHE 230" as it should be.
When I drag another shape into the drawing, same problem. Quantity will be "2" in the legend but both shapes have different names (RQ60 AUMHE 230.157 & RQ60 AUMHE 230. 354). The name in the legend stays RQ60 AUMHE 230.134 .