Shape name changes when dropped on page

Started by Miki, March 01, 2017, 05:12:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Miki

Hello,
I have been creating different shapes in Visio and making edits to the master as required. But today I hit a weird problem.
I had created a master named "Test". This was used in some drawings and then I decided to change it. So I made some changes to that master and renamed it to "NT Test". However, now every time I drop that shape on the drawing and open its shapesheet, the shape name is changed to "Test1.xxxx". This creates a huge problem because I have macro reading the shape's name and it never finds "NT Test".
Why is this happening? I am not able to understand this change.
Weird thing is if I go to Developer>Shape Name, it still shows me "NT Test" but the top of the shapesheet, where it shows the shape name says "Test1".

Can anyone comment on this? Has anyone encountered such problem before?
Thanks.
- Miki

Surrogate

#1
I think there is problem with local and universal names
Quote from: Surrogate on May 28, 2015, 11:20:15 AM
visio have two different types of shape/page names. Local and Universal
Quote from: Surrogate on May 05, 2015, 02:03:50 PM
Quote from: sindemic on May 05, 2015, 01:08:44 PMi didn't still know what is the english universal Name of the Background page, but at least the german local one.
Not at all...
Local and universal pagenames after second renaming are different!
better way use syntax sheet.<ShapeID> instead MyShapeName !
Quote from: JohnGoldsmith on May 21, 2015, 09:24:34 AMuse Sheet.ID syntax as per Surrogate's suggestion

wapperdude

#2
To add to Surrogate's reply, try running this code:

Sub GetName()
    Dim vsoShp As Shape
   
    For Each vsoShp In ActivePage.Shapes
        Debug.Print vsoShp.Name, vsoShp.NameU
    Next
   
End Sub


The point is, don't use shape names to work with shape in code.  Besides re-naming the master, another operation that goofs up the name is copy/paste.

If you want to identify a shape by name reference, a common technique is to create a shapesheet entry, e.g., User.shpName.  It will always be correct, well, provided that it gets updated when a name changes.  Takes a little more code...need to determine if the entry exists, then, fetch the entry.  But it's just code.

HTH
Wapperdude
Visio 2019 Pro

wapperdude

Apparently, I have too much idle time.

Here's a Visio file to show the problems with using shape names for code identifiers.  No.  I did not make a shape with a special shapesheet entry.

Wapperdude
Visio 2019 Pro

Paul Herber

When you dropped the first shape on the page a copy of the master "Test" is made in the document stencil. If you edit the master in your own stencil then drop that modified shape onto the page Visio sees that this is a new master and creates a new version in the document stencil, but cannot call it "Test" as there is a master of that name already, so Visio calls it "Test.xxx".
Electronic and Electrical engineering, business and software stencils for Visio -

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

Miki

Quote from: wapperdude on March 01, 2017, 11:50:17 PM

The point is, don't use shape names to work with shape in code.  Besides re-naming the master, another operation that goofs up the name is copy/paste.

If you want to identify a shape by name reference, a common technique is to create a shapesheet entry, e.g., User.shpName.  It will always be correct, well, provided that it gets updated when a name changes.  Takes a little more code...need to determine if the entry exists, then, fetch the entry.  But it's just code.

HTH
Wapperdude

I like this idea to have a user defined cell containing the shape name. Thank you!

Miki

Quote from: Paul Herber on March 02, 2017, 09:55:13 AM
When you dropped the first shape on the page a copy of the master "Test" is made in the document stencil. If you edit the master in your own stencil then drop that modified shape onto the page Visio sees that this is a new master and creates a new version in the document stencil, but cannot call it "Test" as there is a master of that name already, so Visio calls it "Test.xxx".


I understand that Visio will call it "Test.xxx" and I am completely okay with it (nothing I can do about it). But, Visio, instead of calling it "Test.xxx" calls it "Test1.xxx". That's what I don't understand.

-Miki

joe31623

I had a similar issue, but with tag IDs.  Try exploring the following menu: Process Engineering -> Diagram Options (under the Manage section of the ribbon).

In particular, I had to uncheck: Number Components...