PDA

View Full Version : Select objects inside area



Stern
05-28-2011, 12:41 AM
Hi.
I wonder how to select objects using visual basic which position is inside a defined area. For example, I have a slide full of thousands of objects but I just like to find the one which is in the very left lower corner. Do I have to iterate through all objects and check for .left und .top property to determine the object which is at the lowest left side?
It would also help for me to select the object which is near to a certain point or which would intersect an area I define.
The problem is I have slides which the user can modify (add, move or delete objects) but the user should never delete a certain object being inside a certain area.

John Wilson
05-28-2011, 04:57 AM
I don't see how being able to select a shape in an area with vba would stop people being able to move it?? You would have to loop through all shapes to do this though. If it's just one shape this is fairly easy, if it's a range of shapes I would suggest adding the shapenames to an array and selecting the array. Doesn't the shape have a distinct name, if co you can just select it by name. Maybe you could put that shape on a master?

If your aim is to render certain shapes non selectable this is very difficult to achieve but we can do this for you on a commercial basis (not expensive). You should know though that some badly written add ins that depend of selecting shapes may crash. If you are working in 2007 or 2010 we can also make shapes non movable / resizable but allow colour or text changes.