I have 6 logo i want to random arrange the logo 6 vertical x 6 horizontal. Is there any macro or way to auto arrange the logo's. Any suggestion or help. Thx
[CgsAddInMacro] public void RandomOrder() { //Number of columns and rows, can be changed to any value > 0 int cols = 6, rows = 6; //Initial position, can be changed to any position, //remember to use the same value in the column loop double posX = 0, posY = 0; ShapeRange logos = corelApp.ActiveSelectionRange; logos.Sort("@shape1.width > @shape2.width"); double width = logos[1].SizeWidth; logos.Sort("@shape1.height > @shape2.height"); double height = logos[1].SizeHeight; Random random = new Random(); for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { Shape shape = logos[random.Next(1,logos.Count+1)].Duplicate(); shape.CenterX = posX + width / 2; shape.CenterY = posY + height / 2; posX = posX + width; } posY = posY + height; posX = 0; } logos.Delete(); }
can u plz show demo how it works?
I have 6 color squares, selected all the 6 colors and pasted the script and hit play why its asking to select macro, why its not play direct
Sorry, you asked for an example or an idea, this code is in C#, I know that almost no one uses C#, to use it you need to create a macro for "Visual Studio Tools for Applications", I can always easily convert from C# to VBA in ChatGPT, but this is not working.