Previous Document Next Document

Object Model Reference : Classes : S : Shape : Properties : Shape.ParentGroup


Shape.ParentGroup

Property ParentGroup As Shape

Description

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.

VBA example

The following VBA 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 2013 Corel Corporation. All rights reserved.