/// <summary> /// To avoid corrupted shape. /// Corrupted shape is produced when delete or cut a shape programmatically, but then users undo it. /// After that, most of operations on corrupted shapes will throw an exception. /// One solution for this is to re-allocate its memory: simply cut/copy and paste. /// </summary> /// <param name="shape"></param> /// <returns></returns> private static PowerPoint.Shape CutPasteShape(PowerPoint.Shape shape) { shape.Cut(); shape = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Paste()[1]; return shape; }