order macro - please

left is page view        and         right side is objects manager

shall we bring the images in objects manager to page view

  • For a single column

    Sub SortAndSetPositions()

    Dim sr As ShapeRange

    Set sr = ActiveSelectionRange

    sr.Sort "@shape1.com.positiony > @shape2.com.positiony"

    Dim positionsX() As Double
    Dim positionsY() As Double
    ReDim positionsX(1 To sr.Count)
    ReDim positionsY(1 To sr.Count)

    Dim i As Integer
    For i = 1 To sr.Count
    positionsX(i) = sr(i).PositionX
    positionsY(i) = sr(i).PositionY
    Next i

    sr.Sort "@shape1.com.zorder < @shape2.com.zorder"

    ActiveDocument.BeginCommandGroup
    For i = 1 To sr.Count
    sr(i).SetPosition positionsX(i), positionsY(i)
    Next i

    ActiveDocument.EndCommandGroup
    End Sub

    • objects in page view are shifting by y direction. but it should not be happened.  objects in page view objects maintain the same placement without shifting, but the order should be stacked from top to bottom.  similarly the look that is appearing in the page view, the same must be shown in objects manager also sir

  • I have something that organizes an entire grid but the chatgpt couldn't convert  to VBA

    • sir just imagine we have 6 objects in page view. the view that are existed are correct to our eyes, but while observe the same in objects manager the 6 objects may not in order.

       

      here left is page     and    right is object manager.  

      i want the top object is top and extreme bottom object is bottom. in between objects are beneath the top object .... likewise it has to come down to extreme bottom.  for this objects (by maintaining its same placement) is stacked using the command behind.  hope you understood my english language. not good in english. but hoping so