My question is generic because I've run into this multiple times for other aspects of an object. I will also apologize if this has been asked and I'm just not finding it. Most responses are at the basic level.
My current scenario is that I have a group of blocks that each contain a date (think of a calendar). I am using macros to revise the date based on the current date. However I need to have those blocks grouped so I can animate the collection together.
I believe I have a long work-around that may get me the end result, but it involves code to ungroup, make the change, regroup, reconfigure animation, reassign the trigger, etc., etc. It seems like the simple solution would just to be able to directly modify the text of the grouped object if possible.
Thank you in advance for your time and assistance.
CodePudding user response:
Grouped shapes can be accessed via the parent shape's GroupItems
property.
Eg for a slide containing a single group consisting of several rectangles:
Sub Tester()
Dim s As Shape, e As Shape
With ActivePresentation.Slides(1)
For Each s In .Shapes
Debug.Print "--- " & s.Name & " ---"
'loop group items...
For Each e In s.GroupItems
Debug.Print e.Name
e.TextFrame.TextRange.Text = "OK"
Next e
'address a specific sub-shape
With s.GroupItems("Rectangle 4").TextFrame.TextRange
.Text = "Hi"
End With
Next s
End With
End Sub