How do I use a shape's ID from another field to define beginX

463 views Asked by At

Background: Novice user and VBA programmer - be gentle, please.

Scenario: Using a Visio (2010) straight line connector; Currently 1-D Endpoints.BeginX is as follows:

=PAR(PNT(Milestone.40!Connections.X1,Milestone.40!Connections.Y1))

What I have: A data field in the same shape called BeginItem that contains the Visio ID (e.g. 87) of Milestone.40! above.

What I need to know: If possible, how to change the formula in 1-D Endpoints.BeginX to something like:

=PAR(PNT(BeginItemValue!Connections.X1,BeginItemValue!Connections.Y1))

and if not possible, is there an alternative way of doing this?

Thanks!

1

There are 1 answers

0
Wilhelm On BEST ANSWER

Thanks for helping all. A combination of all advice led me to an alternative solution.

Instead of trying to refer to the field in the Shapesheet that does contain the BeginItemValue, I built the entire string (in VBA) by concatenating the parts and then updated the BeginX value with it.

shpObj.Cells("BeginX").Formula = "=PAR(PNT(" & BeginItemValue & "!Connections.X1," & BeginItemValue & "!Connections.Y1))"

That worked well, although I'm sure there are easier ways of doing it.