I try to ungroup a SmartArt shape from code, but it always causes an error: "This member can only be accessed for a group".
However, it's working, if I right click on the SmartArt shape, and ungroup it.
How can I fix this?
My code is:
public void CreateSmartArt(PowerPoint.Shapes allShapes) { PowerPoint.Shape smartartShape = allShapes.AddSmartArt(IttPowerPoint.Instance.PowerPointApp.SmartArtLayouts["MyLayOut"], 0f, 0f, width, height); Marshal.ReleaseComObject(smartartShape); smartartShape = null; } Public void UngroupSmartArt(PowerPoint.Shape shape) { try { shape.Ungroup(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
Note: I am using VS Ultimate 2013, PowerPoint2013, C#