News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

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.

chelmite

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
Next

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?

Surrogate

#1
Hi,

are you use property: TokenRelation, Relation or both ?

Jumpy

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).

chelmite

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.

Jumpy

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
Next



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.

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 211 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1104KB.
Tokens: post-login.
Cache hits: 12: 0.00116s for 26,766 bytes (show)
Cache misses: 1: (show)
Queries used: 15.

[Show Queries]