get name of item connector is connected to

Started by perry59, February 23, 2020, 10:00:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

I know that this has been discussed before, so please pardon the repeat.
As the title says, I want to get the name of an item that a connector is connected to, BUT I want to do strictly within the shapesheet. I know it can be done via a macro, but I don't want macro's in my shapes. Previously it was said that this is not possible, but that discussion is several years old, perhaps things have changed?

wapperdude

Nope.  Still no shapesheet function to do that.
Visio 2019 Pro

perry59


vojo

in general, shapes are not aware of other shapes around or attached to.
I believe the best you can do is to compare pinx and piny of the connector to the pinx and piny + offsets of the connection point.
if equal, then that connector is attached to connection point Q.

The generalized case would have lots of tedious math...ao I would not try do that.

OldSchool1948

I use a subroutine stored in a module that uses the GluedShapes method as illustrated in the below code snippets to return the Shape IDs for incoming and outgoing 2D shapes on a page, and then parses though them


Set vsoPage = thisDocument.Pages

'// Get all shapes on that page
Dim vsoSelection As Visio.Selection
Set vsoSelection = vsoPage.CreateSelection(visSelTypeAll, _
                                visSelModeSkipSuper, vsoPage)

For i = 1 to vsoSelection.Count

     If isConnector(Shape) = true then   ' A custom function that identifies connectors shapes

         Dim vsoConnector as Visio.Shape
         Set vsoConnector = vsoSelection(i)

         '// Grab the Shape.IDs for all Incoming & Outgoing glued shapes
         Dim srcArrIDs() As Long
         srcArrIDs = vsoConnector.GluedShapes(visGluedShapesIncoming2D, "")

         Dim dstArrIDs() As Long
         dstArrIDs = vsoConnector.GluedShapes(visGluedShapesOutgoing2D, "")

         '// Parse through Source Shapes
         For srcAryCntr = 0 To UBound(srcArrIDs)
       
              Dim srcShape As Visio.Shape
              Set srcShape = vsoPage.Shapes.ItemFromID(srcArrIDs(srcAryCntr))

         '// Parse through Source Shapes
         For dstAryCntr = 0 To UBound(dstArrIDs)

              Dim dstShape As Visio.Shape
              Set dstShape = vsoPage.Shapes.ItemFromID(dstArrIDs(dstAryCntr))