Shape removal


How would I go through a slide and delete any shapes that have text “!!!” (for example)

Everything I try while iterating through the shapes causes a crash. I understand why but I can’t come up with an alternative.


for (int i = slide.Shapes.Count - 1; i >= 0; i–)
if (slide.Shapes[ i ].TextFrame != null)

Sure, you have to check also GroupShapes recursively…


Ahhhh, count backwards. I should have thought of that.

Thanks for doing my thinking for me.