PDA

View Full Version : [SOLVED:] Add shape/textbox in a group dynamically using vba in powerpoint



papuapu
11-21-2021, 03:38 AM
Sir, need some help from this forum.


I have a group(say groupLast1) which consist of some textboxes(say textBox1,textBox2,textBox3) & some shapes(say rectangleTop1, rectangleBottom1).
Now I want to add textbox(say textBoxNew1 )in this group ie in groupLast1 dynamically.
But I cannot configure the grouping part using array.


What I did:


groupLast1.Ungroup
------- fetching shape name from group -------


ActivePresentation.Slides(1).Shapes.(groupLast1)
For x = 1 To GroupItemes.Count


"shapeName" & x = GroupItemes(x).Name


Next x
-------- grouping part------------------


newGshp = ActivePresentation.Slides(1).Shapes.Range(Array("textBoxNew1", ....................)).Group


newGshp.Name = groupLast1


So how to configure the array part(adding fetch name automatically ie "shapeName" & x) so that every time I add some shape/textbox it will automatically configure in group

John Wilson
11-21-2021, 06:16 AM
The code to do this is not simple but fortunately Jamie Garroch has done it for you.

Free PowerPoint VBA to add shape to animated group or object | YOUpresent (http://youpresent.co.uk/free-vba-add-shape-group/)