refer to an object in a group

  • Thread starter Thread starter Linda Edlund
  • Start date Start date
L

Linda Edlund

Is that possible to refer to an object in a group

ActiveSheet.Shapes("group_3"...?..."rectangle_4").Select
or
ActiveSheet.Shapes("group_7"...?..."textbox_3").Text= "abc"


thanks
 
Hi,

You can access a shape within a group but not by name.
You have to use a numeric index.

The following should help. Add 3 rectangles to the active sheet and then
group them.

'---------------------------
Sub X()
Dim shpGroup As Shape
Dim shpTemp As Shape
'
Set shpGroup = ActiveSheet.Shapes(1)
If shpGroup.Type = msoGroup Then
For Each shpTemp In shpGroup.GroupItems
Debug.Print "Grouped shape ", shpTemp.Name
Next
With shpGroup.GroupItems(1)
.Fill.ForeColor.RGB = RGB(0, 255, 0)
End With
Else
' normal ungrouped shape
Debug.Print "Shape ", shpGroup.Name
End If
End Sub
'---------------------------

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top