Sub test_scale_for_max_dimension() Dim s As Shape Dim sr As ShapeRange Dim max_dimension As Double max_dimension = 1.5 Set sr = ActiveSelectionRange For Each s In sr scale_for_max_dimension s, max_dimension Next s End Sub Sub test_rotate_widest_horizontal_faster() Dim s As Shape Dim sr As ShapeRange Set sr = ActiveSelectionRange For Each s In sr rotate_widest_horizontal_faster s Next s End Sub Sub rotate_widest_horizontal_faster(ByRef TargetShape As Shape) Dim sVirtual As Shape Dim ang As Double Dim max_width As Double Dim ang_max_width As Double Set sVirtual = TargetShape.TreeNode.GetCopy().VirtualShape For ang = 0 To 180 Step 0.1 sVirtual.RotationAngle = ang If sVirtual.SizeWidth > max_width Then max_width = sVirtual.SizeWidth ang_max_width = ang End If Next ang sVirtual.Delete TargetShape.RotationAngle = ang_max_width End Sub Sub scale_for_max_dimension(ByRef TargetShape As Shape, ByVal MaxDimension As Double) Dim s As Shape Dim sVirtual As Shape Dim ang As Double Dim max_dim_found As Double Dim x_center As Double Dim y_center As Double Dim scale_factor As Double 'create virtual shape Set sVirtual = TargetShape.TreeNode.GetCopy().VirtualShape 'try angles from 0 to 90 degrees, in 0.1-degree increments For ang = 0 To 90 Step 0.1 'set rotation angle of virtual shape sVirtual.RotationAngle = ang 'Is this the largest width measured so far? If sVirtual.SizeWidth > max_dim_found Then max_dim_found = sVirtual.SizeWidth End If If sVirtual.SizeHeight > max_dim_found Then max_dim_found = sVirtual.SizeHeight End If Next ang 'delete the virtual object sVirtual.Delete Set s = TargetShape 'record original center positions of real object 'x_center = s.CenterX '.CenterX not available in X3? 'y_center = s.CenterY '.CenterY not available in X3? x_center = s.PositionX + s.SizeWidth / 2 'Added for X3 y_center = s.PositionY - s.SizeHeight / 2 'Added for X3 'rescale the real object scale_factor = MaxDimension / max_dim_found s.SizeWidth = s.SizeWidth * scale_factor s.SizeHeight = s.SizeHeight * scale_factor 'reposition to original center positions 's.CenterX = x_center '.CenterX not available in X3? 's.CenterY = y_center '.CenterY not available in X3? s.PositionX = x_center - s.SizeWidth / 2 'Added for X3 s.PositionY = y_center + s.SizeHeight / 2 'Added for X3 End Sub