Changing Shape ID Number?

G

Gary

How can I change the Shape ID number???

I have noticed that the name and the ID number have a correlation in that
the ending number is the same. I have also notice where they are different.

Can someone show me how to change the Shape ID number?? Can it be Alphia
too??? I like to change it to something that when copying, it won't change.

I am currently referencing the ID as follow:

AppVisio.Application.ActiveWindow.Page.Shapes.ItemFromID(38).CellsSRC(visSectionObject, visRowLayerMem, visLayerMember).FormulaU = """0"""


Can I reference the Shape by name instead if ID??? What is the change I
need to me??


Thank You,

Gary
 
H

here1435

the shape ID is read-only so can't be changed
you can refer to it just as you can refer to the name of a shape

Sub id()

Dim oshape As Visio.Shape
For Each oshape In Visio.ActivePage.Shapes
oshape.id = oshape.id + 1 '''fails
MsgBox oshape.id ''gives the id
Next
End Sub

R
 
G

Gary

I already know how to refer to the ID, but I don't know how to refer to the
name. Can you show me how to refer to it by name????

This is now I refer to it by ID:
AppVisio.Application.ActiveWindow.Page.Shapes.ItemFromID(38).CellsSRC(visSectionObject, visRowLayerMem, visLayerMember).FormulaU = """0"""

What would I need to change to refer to its by name???


Thank You,

Gary


P.S. Can I change the name????? and refer to the new name???
 
J

John

Hi Gary,

The shapes collection of the Page object will identify a shape by name, so
to adapt your code below, just use:

AppVisio.Application.ActivePage.Shapes("Sheet.4") 'or what ever shape name
you want to refer to.

Bear in mind that the "ID" property of a shape object is just a number
that's added as the shape is dropped onto the page and that "NameID" is only
unique within a single page. You might find it easier to set a reference to
the shape as you capture it by selection or perhaps by name as you are
doing, and from then on refer to it by that reference. So for example:

Dim shp As Shape

Set shp = AppVisio.Application.ActivePage.Shapes("Sheet.4")

shp.Cells("PinX").Formula = 1.25
etc.

If you need a truely unique reference across a whole document then use the
"UniqueID" property (have a look in help for an example).

Hope that helps

Best regards

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top