Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the sanity check. I could not figure out what was happening.
It is kind of odd that .name changes the selection order. I tweaked the code you sent me and it works perfectly for my application. I can select 10 autoshapes and it puts arrows between each of them in the order that I selected them. Thanks a ton!!! Scott Here is the code I ended up with for those who are interested: Function SelectedObjects() As Variant Dim a() As Object, obj As Object Dim i As Long If TypeName(Selection) = "DrawingObjects" Then ReDim a(1 To Selection.Count) For Each obj In Selection i = i + 1 Set a(i) = obj Next SelectedObjects = a End If End Function Sub Test() Dim selobj As Variant Dim i As Long 'accessing object(e.g. "selobj(i).Name") seems to reset selection order. selobj = SelectedObjects() If IsArray(selobj) Then For i = 1 To UBound(selobj) - 1 Debug.Print selobj(i).Name ActiveSheet.Shapes.AddConnector(msoConnectorStraig ht, 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(selobj(i).Name), 3 i = i + 1 Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes(selobj(i).Name), 1 i = i - 1 Next End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Programmatically add shapes to a selection | Excel Programming | |||
Programmatically add shapes to a selection | Excel Programming | |||
Tab Order Code Problem | Excel Programming | |||
Date Range Selection the ODBC connection to database | Excel Programming | |||
Disable selection of shapes | Excel Programming |