Previous Document Next Document
Shape.ParentGroup

Property ParentGroup As Shape

Member of Shape

The ParentGroup property returns a Shape object that represents the group shape to which the active shape belongs. If the shape is not part of a group, Nothing is selected.

The ParentGroup property returns a read-only value.

The following code example extracts an object from a group and places it at the same level as the group object:

Sub Test() 
 Dim s As Shape, g As Shape 
 Set s = ActiveShape 
 If s Is Nothing Then 
  MsgBox "Please select an object", vbCritical 
  Exit Sub 
 End If 
 Set g = s.ParentGroup 
 If g Is Nothing Then 
  MsgBox "Please select an object within a group", vbCritical 
  Exit Sub 
 End If 
 ActiveDocument.PreserveSelection = False 
 g.CreateSelection 
 g.Ungroup 
 s.Selected = False 
 ActiveSelection.Group 
 s.CreateSelection 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.