Share via


Shape.Ungroup Method

Ungroups any grouped shapes in the specified shape or range of shapes. Disassembles pictures and OLE objects within the specified shape or range of shapes. Returns the ungrouped shapes as a single ShapeRange object.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Function Ungroup As ShapeRange
'Usage
Dim instance As Shape
Dim returnValue As ShapeRange

returnValue = instance.Ungroup()
ShapeRange Ungroup()

Return Value

Type: Microsoft.Office.Interop.PowerPoint.ShapeRange
ShapeRange

Remarks

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Examples

This example ungroups any grouped shapes and disassembles any pictures or OLE objects on myDocument.

Set myDocument = ActivePresentation.Slides(1)

For Each s In myDocument.Shapes

    s.UngroupNext

This example ungroups any grouped shapes on myDocument without disassembling pictures or OLE objects on the slide.

Set myDocument = ActivePresentation.Slides(1)

For Each s In myDocument.Shapes

    If s.Type = msoGroup Then s.UngroupNext

See Also

Reference

Shape Interface

Shape Members

Microsoft.Office.Interop.PowerPoint Namespace