'Listing link between pictures

I'm working on a project where I'm trying to recreate an industrial process by moving pictures of equipment and linking them with arrows to establish the connections and sequence of my process.

I'm fairly new to vba and I'm stuck.

I'm able to insert new equipment by clicking on their picture, it copy and paste the picture, a userform pops up and I set the name of the picture and other parameters. equipment inventory and what it would look like connected

I played with some macro that allows me to list pictures or shape on the worksheet which is great. But I didn't find anything that would allow me to list the connections. I know that those connections are "recorded" as I recorded a macro that shows it.connection between 2 pictures

Any idea on how I would be able to list those connections on a worksheet and establish what is connected to what and what comes before what.

Thank you.

{edit} code :

recorded connection

Sub connection_stack()

ActiveSheet.Shapes.Range(Array("C3")).Select
Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.Shapes("TO1"), 4
Selection.ShapeRange.ScaleWidth 2.9100441391, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 2, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.5, msoFalse, msoScaleFromBottomRight
Selection.ShapeRange.ScaleHeight 23.7025647736, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.Flip msoFlipVertical
Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes( _
    "Picture 84"), 2
Selection.ShapeRange.ScaleWidth 0.4494922067, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.0143200614, msoFalse, _
    msoScaleFromBottomRight

End Sub

adding an equipment

Sub New_TO()

ActiveSheet.Shapes.Range(Array("Picture 5")).Select
Selection.Copy
ActiveSheet.Paste
Selection.OnAction = ""
Selection.ShapeRange.IncrementLeft 138.4090551181
Selection.ShapeRange.IncrementTop -8.1818110236
Selection.Name = "TO_transit"
newTO.Show

End Sub

changing name of equipment from form

once I create new equipment (copy of the pictures with new names) I connect them manually with the arrow that I create and name the same way I do with equipment.



Solution 1:[1]

A connector is a shape. You just need to loop trough each shape and check if it's a connector with the property Shape.Connector

Shape.Connector (Excel)

As example, I made 3 shapes and 2 connectors:

enter image description here

My code:

Sub test()

Dim kk As Shape
Dim wk As Worksheet


Set wk = ActiveSheet

For Each kk In wk.Shapes
    If kk.Connector = msoTrue Then
        Debug.Print "From ", kk.ConnectorFormat.BeginConnectedShape.Name, " to ", kk.ConnectorFormat.EndConnectedShape.Name
    End If
Next kk


End Sub

The output I get is exactly how I made my connectors:

From          Rectangle 1    to           Oval 2
From          Oval 2         to           Snip Single Corner Rectangle 3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Foxfire And Burns And Burns