Hi. Does anybody know how to select the largest shape in page?
The problem is the following: I have many shapes within a large rectangle and also some shapes outside the same rectangle.
I want the macro to identify the largest shape in page (the rectangle in this case) and, based on its coordinates, to select all the shapes within the rectangle and group them alltogheter.
Thank you very much!
sorin12003 said:@shape1.width > @shape2.width and @shape1.height > @shape2.height"
Draw two rectangles of 2 cm x 4 cm and 3 cm x 3 cm. The area of the second one will be larger, but its width (3) will be less than the width of the first rectangle (4) and maybe it will not be sorted correctly
Totaly agree but in my case there is only one BIG rectangle and some other shapes inside and outside :)
Your solution .SelectShapesFromRectangle saved me from a loop.
Thank you very much Shark_!
Shark is correct it would be better to do this:
sr.Sort "@shape1.width * @shape1.height > @shape2.width * @shape2.height"
Using the area will still be more precise, but as you said maybe a little slower, so you may prefer the above.
Happy coding,
-Shelby
thank you