-
Sep 20th, 2020, 09:12 AM
#1
Thread Starter
New Member
[Powerpoint]Working with group shape
Sir help please if possible
I am working with a group shape(called "group1"), which contains three text boxes with text & a hexagon(all text boxes are in hexagonal shape that's makes that group called "group1").This group has four animation also.
My requirement is creates ten group(ex- group1, group2,.....group10) of same shape, size, animation with delay of 4.5.
I configure below code but gives error "The specific value is out of range" for line gshp.PickUp.
Any other solution will be appreciated.
Sub addAnnimationBlocks()
Dim oeff As Effect
Dim i As Integer
Dim t As Long
Dim l As Long
Dim h As Long
Dim w As Long
Dim j As Long
Dim C As Long
Dim X As Long
Dim gshp As Shape
Dim groupShp As Shape
Dim osld As Slide
Set osld = ActivePresentation.Slides(1)
For j = 1 To 9
Set gshp = osld.Shapes("group" & j)
gshp.PickupAnimation
gshp.PickUp
'Capture properties of exisitng group1 such as location and size
With gshp
t = .Top
l = .Left
h = .Height
w = .Width
End With
Set groupShp = osld.Shapes.AddShape(gshp.AutoShapeType, l, t, w, h)
For i = 1 To gshp.GroupItems.Count
If gshp.GroupItems(i).HasTextFrame Then
groupShp.GroupItems(i).TextFrame.TextRange = gshp.GroupItems(i).TextFrame.TextRange
End If
Next
groupShp.Apply
groupShp.ApplyAnimation
For C = 1 To osld.TimeLine.MainSequence.Count
If osld.TimeLine.MainSequence(C).Shape.Id = groupShp.Id Then
X = X + 1
Set oeff = osld.TimeLine.MainSequence(C)
Select Case X
Case Is = 1
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = (j - 1) * 4.5
Case Is = 2
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = j * 4.5
Case Is = 3
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = (j + 1) * 4.5
Case Is = 4
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = (j + 2) * 4.5
End Select
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
groupShp.Name = "group" & j + 1
End If
Next C
X = 0
Next j
End Sub
-
Sep 20th, 2020, 04:19 PM
#2
Re: [Powerpoint]Working with group shape
What is the value of j when it fails?
It looks like you are only using 9 groups, not 10.
Have you created the 10 groups before you start the loop? It can't reference group2 if group2 doesn't exist.
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
-
Sep 21st, 2020, 04:52 AM
#3
Re: [Powerpoint]Working with group shape
i am not sure that you can do a pickup of the group, maybe only the individual shapes
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 21st, 2020, 12:56 PM
#4
Thread Starter
New Member
Re: [Powerpoint]Working with group shape
Originally Posted by passel
What is the value of j when it fails?
It looks like you are only using 9 groups, not 10.
Have you created the 10 groups before you start the loop? It can't reference group2 if group2 doesn't exist.
I have created only one group ie group1 . Then apply loop for create another 9 groups.
-
Sep 21st, 2020, 01:03 PM
#5
Thread Starter
New Member
Re: [Powerpoint]Working with group shape
Thanks @westconn1
I have never work with group shapes this is the first time i give a try but not works. It may be correct that pickup method can not be use for copying group properties. So how to solve above code, any ideas will be appreciated. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|