Jhon90
09-17-2020, 12:07 AM
Sir please help
I have a group shape(also have animation) consist of a rectangle & three text box with text in it. I want to configure a code which will generate 10 groups(ie group1, group2, group3,.......group10) with same shape, size, location, animation, textbox with text same as group1. After generating I also want to replace all text in the textboxes with some other text.But I have no idea how to work with group & subshape object. For start I try to generate 10 group in below code but got error "The specified value is out of range" for this gshp.PickUpline. Any other solution will be appreciated.
Thanks in advance.
Sub addGrp()
Dim oeff As Effect
Dim t As Long
Dim l As Long
Dim h As Long
Dim w As Long
Dim j As Long
Dim gshp As Shape
Dim grpshp As Shape
Dim osld As Slide
Set osld = ActivePresentation.Slides(1)
For j = 1 To 10
Set gshp = osld.Shapes("group" & j)
If gshp Is Nothing Then GoTo err
gshp.PickupAnimation
gshp.PickUp
With gshp
t = .Top
l = .Left
h = .Height
w = .Width
End With
Set grpshp = osld.Shapes.AddShape(gshp.AutoShapeType, l, t, w, h)
grpshp.Apply
grpshp.ApplyAnimation
Set oeff = osld.TimeLine.MainSequence.FindFirstAnimationFor(grpshp)
oeff.Timing.TriggerDelayTime = (j - 4) * 4.5
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
grpshp.Name = "group" & j + 1
Next j
Exit Sub
err:
MsgBox "Error, please select a shape."
End Sub
I have a group shape(also have animation) consist of a rectangle & three text box with text in it. I want to configure a code which will generate 10 groups(ie group1, group2, group3,.......group10) with same shape, size, location, animation, textbox with text same as group1. After generating I also want to replace all text in the textboxes with some other text.But I have no idea how to work with group & subshape object. For start I try to generate 10 group in below code but got error "The specified value is out of range" for this gshp.PickUpline. Any other solution will be appreciated.
Thanks in advance.
Sub addGrp()
Dim oeff As Effect
Dim t As Long
Dim l As Long
Dim h As Long
Dim w As Long
Dim j As Long
Dim gshp As Shape
Dim grpshp As Shape
Dim osld As Slide
Set osld = ActivePresentation.Slides(1)
For j = 1 To 10
Set gshp = osld.Shapes("group" & j)
If gshp Is Nothing Then GoTo err
gshp.PickupAnimation
gshp.PickUp
With gshp
t = .Top
l = .Left
h = .Height
w = .Width
End With
Set grpshp = osld.Shapes.AddShape(gshp.AutoShapeType, l, t, w, h)
grpshp.Apply
grpshp.ApplyAnimation
Set oeff = osld.TimeLine.MainSequence.FindFirstAnimationFor(grpshp)
oeff.Timing.TriggerDelayTime = (j - 4) * 4.5
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
grpshp.Name = "group" & j + 1
Next j
Exit Sub
err:
MsgBox "Error, please select a shape."
End Sub