API Documentation > CorelDRAW > 2025-v26 > Shape > IVGShape
Shape.UngroupAll method
Ungroups all shapes, including nested groups
Syntax:
Sub UngroupAll()
Remarks:
The UngroupAll method ungroups all shapes in a given group and in any subgroups contained by it.
Examples:
The following VBA example ungroups any nested groups on the active page. Top-level groups remain unchanged, while nested groups are ungrouped.
Sub Test()
Dim s As Shape, sg As Shape
For Each s In ActivePage.Shapes
  If s.Type = cdrGroupShape Then

 For Each sg In s.Shapes


If sg.Type = cdrGroupShape Then


  sg.UngroupAll


End If

 Next sg
  End If
Next s 
End Sub