Author Topic: Legend shape - How to change description name  (Read 3855 times)

0 Members and 1 Guest are viewing this topic.

Bogardo

  • Newbie
  • *
  • Posts: 7
Legend shape - How to change description name
« on: March 28, 2012, 09:57:05 AM »
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:
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?
« Last Edit: March 28, 2012, 09:58:58 AM by Bogardo »

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3379
    • Paul Herber's website
Re: Legend shape - How to change description name
« Reply #1 on: March 28, 2012, 10:12:24 AM »
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 and applications for Visio -

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

Bogardo

  • Newbie
  • *
  • Posts: 7
Re: Legend shape - How to change description name
« Reply #2 on: March 28, 2012, 12:47:55 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 .