I'm working on a script to sort elements in the objects docker (and on the page as well of course) I've tried both Optimization and EventsEnabled and both work on the page BUT the property docker does not update unless I click on another drawing tab and then back again - or save the drawing and reload.

This is using CD ver 2019

Here's the code:(and this is pretty basic - I need to make a proper bubble sort)

Sub ShapeSort() Dim i As Integer, j As Integer, k As Integer, m As Integer, One As Shape, Two As Shape Dim sr As ShapeRange Set sr = ActiveLayer.FindShapes 'all types m = 10 * sr.Count Optimization = True For k = 1 To m For i = 1 To sr.Count For j = i + 1 To sr.Count Set One = sr(i) Set Two = sr(j) If One.Type > Two.Type Then Two.OrderForwardOne End If Next j Next i Next k Optimization = False ActiveWindow.Refresh Application.Refresh End Sub

SubShapeSort()
Dim i AsInteger, j AsInteger, k AsInteger, m AsInteger, One As Shape, Two As Shape
Dim sr As ShapeRange
Set sr = ActiveLayer.FindShapes 'all types
m = 10 * sr.Count
Optimization = TrueFor k = 1To m
For i = 1To sr.Count
For j = i + 1To sr.Count
Set One = sr(i)
Set Two = sr(j)
If One.Type > Two.Type Then
Two.OrderForwardOne
EndIfDoEventsNext j
Next i
Next k
Optimization = False
ActiveWindow.Refresh
Application.Refresh
EndSub