Changing shape name

Started by andlop, May 12, 2020, 02:18:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi! I know that it is possible to change a shapes name in the developer tab, but I wanted to know if it is possible to change it by adding a field in the Shape Data, and program it to do the same thing. Or it is possible to do the same thing, but using programming in the ShapeSheet.

Thank you!


I know it is not the answer to your question, but it is generally a bad idea to work with shape names.
Those named shapes could be deleted, moved to another page, just to name some of the problems.
You're better off by defining a certain property - eg a user or a prop field - and set its value to an arbitrary unique id (eg chosen by yourself).
To work with that shape, you would iterate over the shapes of the page and check for the existance of the property and its value.
I Hope the explanation is somewhat comprehensible.


Understood, and how do I get the shape properties in the page, like its ID?


The shape ID resides with the shape, not the page it's on.   You don't really want to added it to the page...That creates a lot of extra, unnecessary work.  It would be like hot gluing your socks to the drawer their in.
Visio 2019 Pro


But when a create a master, in the master page, the shape as one ID, but if I put that shape in a drawing I can't get the masters ID...

Paul Herber

Within the stencil, a master has an index, but once the master shape has been dropped on a page that index is no longer available (nor is it useful or required). The only reference from the shape on the page is to the Master name.
Electronic and Electrical engineering, business and software stencils for Visio -


I have used the command MASTERNAME() in the ShapeSheet, to get the masters name when I drop it on the drawing. The thing is, my master name is "Roller conveyor", and the MASTERNAME() output is "Roller conveyor: Roller conveyor". I'm doing a application where I needed to this two names to be the same.


Quote from: andlop on May 14, 2020, 11:24:01 AM
Understood, and how do I get the shape properties in the page, like its ID?

function getMyShape() as shape

  for each shp in activepage.shapes
    if shp.cellexists("user.MyIdentificator", visexistsanywhere) then
      if shp.cells("user.MyIdentificator").resultstr("") = "I am the right shape" then
        getMyShape = shp
        exit function
  next shp

end function