Knowing when an object can be ungrouped programmatically

P

Purvi

Hi,

I've a macro that ungroups embedded objects, grouped
objects and pictures. When you try to ungroup an object
manually, if further ungrouping is not possible, then the
ungroup option is grayed out.
Is there a way to find out programmatically if the object
cannot be ungrouped?

Thanks,
Purvi
 
J

Jezebel

It's a bit cludgy, but you can use:

on error resume next
p = Shape.GoupItems.Count
IsGrouped = (Err.Number = 0)
on error goto 0

or more simply

on error resume next
Shape.Ungroup
if err.number <> 0 then
... not grouped
 
Top