How do I access properties on a Connector via VBA?

Started by chelmite, February 21, 2013, 05:50:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I have a drawing where I use Connectors (on a UML Activity drawing) to represent relationships between the attached shapes.
If I look at the ShapeSheet for the Connector, I can see a ShapeData row:
Prop.Relation: Label "Relation", ... value="fwdRel"

If that connector connects shapes A and B, how, in visual basic, do I access the connector's Prop.Relation?
I tried
For Each conObj in A.FromConnects
   If conObj.CellExistsU("Prop.TokenRelation", 0) Then
      Debug.Print "Found the property!"
  End if

But I get the complaint: "Run-time error '438': Object doesn't support this property or method".
It looks like it's complaining that conObj, which should be a Connect object, doesn't have a CellExistsU method.

How do I access the property that's on the Connector?



are you use property: TokenRelation, Relation or both ?


conObj is a connection Object, not a shape. conObj.ToShape and conObj.FromShape are the two shapes (the connector and the shape the connector connects to).


To Surrogate: TokenRelation should have been Relation, but that's just a posting typo.

Is the Connection Object different from the UML connector or the line that's connected between two shapes?
The UML connector seems to have a bunch of hidden stuff that's getting in the way of getting access to the properties.


The connection object is a Visio object that represents the actual connection, the fact, that two shapes are connected.
It is not the connector, it is not a shape!!!!

The two shapes represented in the conObject are the connector and the shape with the connection point the connector connects to.

a connect object has
a FromShape, often the connector
a FromCell, a Cell of FromShape, often BeginX or EndX
a ToShape, often a 2D-Shape with a connection point
a ToCell, often a connection point of ToShape

hope that clarifys that a bit.

Your code could be:

For Each conObj in A.FromConnects
   If conObj.FromShape.CellExistsU("Prop.TokenRelation", 0) Then
      Debug.Print "Found the property!"
  End if

Last: The UML-Connector is different from the normal Connector, because it has more Data that is hidden somewhere in the AddOn, but for purposes of connection and reading ShapeData it doesn't matter.