B
brotherescott
I am trying to write a little macro that will connect the 2 selected
autoshapes flow chart boxes. My problem is if I put 5 boxes on the
worksheet and have them ordered 5-4-3-2-1. If I select #5 and them #4
it wants to connect #4 to #5. My code can not get the name of the first
selected box(#5) as item(1).name. You can see all the ways I tried to
get A & B to give me A=5 and B=4 in the scenario I described. If anyone
can help me on my selection order problem I would appreciate it.
Thanks
Scott
Sub shapeconnect()
A = Selection.Item(1).Name
B = Selection.Item(2).Name
A = Selection.ShapeRange.Item(1).Name
B = Selection.ShapeRange.Item(2).Name
A = Selection.ShapeRange(1).Name
B = Selection.ShapeRange(2).Name
A = Selection(1).ShapeRange.Item(1).Name
B = Selection(2).ShapeRange.Item(1).Name
ActiveSheet.Shapes.AddConnector(msoConnectorStraight, 129.75,
130.5, 1.5, 16.5).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Selection.ShapeRange.ConnectorFormat.BeginConnect
ActiveSheet.Shapes(A), 3
Selection.ShapeRange.ConnectorFormat.EndConnect
ActiveSheet.Shapes(B), 1
End Sub
autoshapes flow chart boxes. My problem is if I put 5 boxes on the
worksheet and have them ordered 5-4-3-2-1. If I select #5 and them #4
it wants to connect #4 to #5. My code can not get the name of the first
selected box(#5) as item(1).name. You can see all the ways I tried to
get A & B to give me A=5 and B=4 in the scenario I described. If anyone
can help me on my selection order problem I would appreciate it.
Thanks
Scott
Sub shapeconnect()
A = Selection.Item(1).Name
B = Selection.Item(2).Name
A = Selection.ShapeRange.Item(1).Name
B = Selection.ShapeRange.Item(2).Name
A = Selection.ShapeRange(1).Name
B = Selection.ShapeRange(2).Name
A = Selection(1).ShapeRange.Item(1).Name
B = Selection(2).ShapeRange.Item(1).Name
ActiveSheet.Shapes.AddConnector(msoConnectorStraight, 129.75,
130.5, 1.5, 16.5).Select
Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical
Selection.ShapeRange.ConnectorFormat.BeginConnect
ActiveSheet.Shapes(A), 3
Selection.ShapeRange.ConnectorFormat.EndConnect
ActiveSheet.Shapes(B), 1
End Sub