I make a selection (top) and then run my macro and though the macro does fine it leaves the selection in this state (bottom) whereby requiring me to deselect and select again
What is my code missing?
Sub BreakDimensions()Optimization = TrueActiveDocument.BeginCommandGroup "BreakDimension" Dim sr As ShapeRange, s As Shape Set sr = ActiveSelectionRange For Each s In sr If Not s.Type = cdrLinearDimensionShape Then s.RemoveFromSelection End If Next s ActiveSelection.BreakApart sr.AddToSelection sr.Group Optimization = False ActiveDocument.EndCommandGroup End Sub
I am assuming you want to break apart the dimensions so you can group the shapes and dimensions on the layer to easily rescale it for your documents.
That's what I explained in my original post. The macro works perfectly as I have except that it finishing in a different grouped state as expected. It has round selection glyphs instead of the usual squares
try modified code
Sub BreakDimensions()Optimization = TrueActiveDocument.BeginCommandGroup "BreakDimension"Dim sr As ShapeRange, s As ShapeSet sr = ActiveSelectionRangeFor Each s In srIf Not s.Type = cdrLinearDimensionShape Thens.RemoveFromSelectionEnd IfNext sActiveSelection.BreakApartsr.AddToSelection
Optimization = FalseActiveDocument.EndCommandGroupEnd Sub
DING! DING! DING! You win a prize! Well how about a big thank you Mek? Again.
And the prize is ...?