1

Hello I would like to change the color of a specific shape called "icon1" which is in a group called "Box1" but this "Box1" is in a group called "BigBox1" (So icon1 is in a subgroup). There is also other shapes and text boxes in the group "Box1" (other shapes:"icon2","icon3"/ "text1", "text2") which I don't want to change the color. I have tried to change the color of the "icon1" but VBA told me that the item with this name could not be found.

Sub changeshapecolorinsubgroup()
ActiveDocument.Shapes("BigBox1").GroupItems("Box1").GroupItems("icon1").Fill.ForeColor.RGB = RGB(255, 200, 128)
End Sub

I don't know how to fix my problem, could you help me?

BigBen
  • 46,229
  • 7
  • 24
  • 40

1 Answers1

0

When you group all these shapes, it becomes one shaperange. I am assuming that BigBox1 is the name of the final shaperange which has all the above items. If you are not sure what is the name of the big group then select it and in vba editor type this

?Selection.ShapeRange.Name

Finally you can achieve what you want using this

ActiveDocument.Shapes("BigBox1").GroupItems("icon1").Fill.ForeColor.RGB = RGB(255, 200, 128)
Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250