Use Shape.GluedShapes(Flags, CategoryFilter, [pOtherConnectedShape]) to return an array of identifiers for the shapes that are glued to a shape. The returned IDs can be filtered by 1D vs. 2D and by incoming vs. outgoing connections. You can optionally specify another shape to which any returned shapes must also be glued.
· Flags: Specifies dimensionality and directionality of connectors of shapes returned. The values are defined by the enumeration VisGluedShapesFlags.
visGluedShapesAll1D
visGluedShapesIncoming1D
visGluedShapesOutgoing1D
visGluedShapesAll2D
visGluedShapesIncoming2D
visGluedShapesOutgoing2D
· CategoryFilter: Specifies category of shapes returned. The categories a shape belongs to are defined in its User.msvShapeCategories cell.
· pOtherConnectedShape: Optional additional shape to which returned shapes must also be glued
PublicSub GetGluedShapes()'Use Shape.GluedShapes to get the shapes that are glued to a shapeDim shp As Visio.ShapeDim shpIDs() AsLongDim i AsInteger Debug.Print "GluedShapes"If ActiveWindow.Selection.Count = 0 Then MsgBox ("select a shape with connections")ExitSubElseSet shp = ActiveWindow.Selection(1)EndIf shpIDs = shp.GluedShapes(visGluedShapesIncoming1D, "") Debug.Print "Incoming 1D shapes"For i = 0 To UBound(shpIDs) Debug.Print ActivePage.Shapes(shpIDs(i)).NameNext shpIDs = shp.GluedShapes(visGluedShapesOutgoing1D, "") Debug.Print "Outgoing 1D shapes"For i = 0 To UBound(shpIDs) Debug.Print ActivePage.Shapes(shpIDs(i)).NameNext shpIDs = shp.GluedShapes(visGluedShapesIncoming2D, "") Debug.Print "Incoming 2D shapes"For i = 0 To UBound(shpIDs) Debug.Print ActivePage.Shapes(shpIDs(i)).NameNext shpIDs = shp.GluedShapes(visGluedShapesOutgoing2D, "") Debug.Print "Outgoing 2D shapes"For i = 0 To UBound(shpIDs) Debug.Print ActivePage.Shapes(shpIDs(i)).NameNextEndSub