Sub CenterObjects()'center_objects1Dim OrigSelection As ShapeRangeSet OrigSelection = ActiveSelectionRangeOrigSelection(2).AlignToShape cdrAlignHCenter + cdrAlignVCenter, OrigSelection(1), cdrTextAlignBoundingBoxEnd Sub
Only two objects are accepting to make it center... if i select more... then this macro not working.
please update
Hello,Here is my improved code.All selected shapes will be centered to last selected shape
Sub BhBp_CenterObjects()
'all shapes will be centered to last selected shapeDim first_shape As ShapeDim OrigSelection As ShapeRangeSet OrigSelection = ActiveSelectionRangeSet first_shape = OrigSelection(1)'first_shape.Fill.UniformColor.RGBAssign 255, 0, 0For X = 2 To OrigSelection.Shapes.Count'OrigSelection(X).Fill.UniformColor.RGBAssign 255, 0, 0'all shapes will be centered to last selected shapeOrigSelection(X).AlignToShape cdrAlignHCenter + cdrAlignVCenter, OrigSelection(1), cdrTextAlignBoundingBox'all shapes will be centered to first selected shape'OrigSelection(X).AlignToShape cdrAlignHCenter + cdrAlignVCenter, OrigSelection(OrigSelection.Shapes.Count), cdrTextAlignBoundingBoxNextEnd Sub