Reference to a SubShape in a Group

C

Chuck Cobb

I'm trying to construct a formula in a group that references a subshape
within the group. The formula looks something like this

Dim SubShapeName = vsoSubShape.Name
Dim Formula as String = "Guard(" &SubShapeName & "!Width*0.5)"

When I attempt to programmably load the formula in the shapesheet cell I get
an error that says "Bad Shape Name".

Is it necessary to prefix a subshape with the name of the group somehow to
reference it or is there some other special
trick I don't know about to reference the name of a subshape within a group?

Thanks,

Chuck
 
R

Russ McKenna

You need to reference the NameID not the Name.

Use Sheet.123 instead of MySubShape.

Visio will control appropriate updating of names when you copy and paste.
 
C

Chuck Cobb

Thanks, That worked great! For some reason, I've been able to get away with
just using the name of the shape for other references.
 
R

Russ McKenna

You should really change to NameID. Name works when it is in the same scope,
but the danger is that you can change the name. You can not change the Name
ID. Of course the NameID does change, but Visio maintains this and changes
all references. So if you use SETF function use GetRef(Sheet.252), not
"Sheet.252". The later would not be updated.
 

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