Doflamingo
Board Regular
- Joined
- Apr 16, 2019
- Messages
- 238
Hi all,
Here is the code to add automatically connectors between 2 shapes
But with the connector arrow, for 2 different shapes, it's completely HORIZONTAL but not vertical
and for the connector elbow, at each creation, I have to go to ''Format'' and ''size'' for each connector if it's horizontal or vertical I have to put ''0'' to get a straight line ...
any idea to get elbow connector completely vertical/horizontal, same thing for vertical elbow ?
Here is the code to add automatically connectors between 2 shapes
Code:
Set forga = Sheets("orgaShapes")
Set f = Sheets("liensSupplémentaires")
For Each s In forga.Shapes
If Right(s.Name, 4) = "Lien" Then s.Delete
Next
Tbl = f.Range("A2:C" & f.[A65000].End(xlUp).Row).Value
n = UBound(Tbl)
For i = 1 To UBound(Tbl)
shape1 = Tbl(i, 1)
shape2 = Tbl(i, 2)
If Tbl(i, 3) = "Arrow" Then
forga.Shapes.AddConnector(msoConnectorStraight, 100, 100, 100, 100).Name = shape1 & shape2 & "Lien"
forga.Shapes(shape1 & shape2 & "Lien").Line.BeginArrowheadStyle = msoArrowheadTriangle
forga.Shapes(shape1 & shape2 & "Lien").Line.EndArrowheadStyle = msoArrowheadTriangle
Else
forga.Shapes.AddConnector(msoConnectorElbow, 100, 100, 100, 100).Name = shape1 & shape2 & "Lien"
forga.Shapes(shape1 & shape2 & "Lien").Line.ForeColor.SchemeColor = 22
End If
forga.Shapes(shape1 & shape2 & "Lien").ConnectorFormat.BeginConnect forga.Shapes(shape1), 4
forga.Shapes(shape1 & shape2 & "Lien").ConnectorFormat.EndConnect forga.Shapes(shape2), 2
forga.Shapes(shape1 & shape2 & "Lien").Line.DashStyle = msoLineDash
Next i
But with the connector arrow, for 2 different shapes, it's completely HORIZONTAL but not vertical
Code:
If Tbl(i, 3) = "Arrow" Then
forga.Shapes.AddConnector(msoConnectorStraight, 100, 100, 100, 100).Name = shape1 & shape2 & "Lien"
forga.Shapes(shape1 & shape2 & "Lien").Line.BeginArrowheadStyle = msoArrowheadTriangle
forga.Shapes(shape1 & shape2 & "Lien").Line.EndArrowheadStyle = msoArrowheadTriangle
Else
and for the connector elbow, at each creation, I have to go to ''Format'' and ''size'' for each connector if it's horizontal or vertical I have to put ''0'' to get a straight line ...
Code:
forga.Shapes.AddConnector(msoConnectorElbow, 100, 100, 100, 100).Name = shape1 & shape2 & "Lien"
forga.Shapes(shape1 & shape2 & "Lien").Line.ForeColor.SchemeColor = 22
any idea to get elbow connector completely vertical/horizontal, same thing for vertical elbow ?