Hello,Please help with VBA code
I have 2 shapes in upper left corner of picture above. I select 2 shapes and start SUB REPLACE()
Arrows show a necessary resultRectangle replace ellipse orEllipse replace rectangleGreetings!
Use the macro below.It replaces all selected shapes with the last selected object.Sub Macro1() Dim s As Shape, s1 As Shape, s2 As Shape, SR As ShapeRange Set SR = ActiveSelectionRange Set s1 = SR.Shapes.First s1.RemoveFromSelection Set SR = ActiveSelectionRange For Each s In SR Set s2 = s1.Duplicate s2.CenterX = s.CenterX s2.CenterY = s.CenterY Next s SR.DeleteEnd Sub
I think that is a very good approach. One advantage of the way you are doing it is that it allows one to use some other tool - e.g., CorelDRAW's "Find" capability, or the Select Same macro - to help prepare the selection before running the macro.
Another thing you could add would be something to help maintain the stacking order:
s2.OrderFrontOf s
When I wrote the macro, the question of stacking order did not arise for me. I need to replace all the selected shapes and the macro does it. But the color, shape type, angle of shape rotation etc - up to you. I agree Eskimo that your ideas are interesting.
Thank You!
I have this question, because I will change all symbols with other. Answer is valid for changing one symbol with other. I not found using Find/Replace to change all symbols /by Example SymbolOLD/ with SymbolNEW. More then. I try to save SymbolNEW with name SymbolOLD, but replacment is not possible. Only warning message apears, that SymbolOLD exist.Greetings!
Just as an aside: If you're looking for a affordable macro that replaces shapes shapes (with options for transformations during replacement) and more: http://macromonster.com/product/dizzy-shaping-version-3/
I like the distribute by spacing module too.