
Originally Posted by
dibyendu2280
Try
Sub addAnnimation()
Dim oeff As Effect
Dim C As Long
Dim X As Long
Dim t As Long
Dim l As Long
Dim h As Long
Dim w As Long
Dim shp As Shape
Dim osld As Slide
Dim recnewShp As Shape
On Error Resume Next
Set osld = ActivePresentation.Slides(1)
Set shp = osld.Shapes("Rectangle 1")
shp.PickupAnimation
shp.PickUp
'Capture properties of exisitng Rectangle1 such as location and size
With shp
t = .Top
l = .Left
h = .Height
w = .Width
End With
Set recnewShp = osld.Shapes.AddShape(shp.AutoShapeType, l, t, w, h)
recnewShp.Apply
recnewShp.ApplyAnimation
For C = 1 To osld.TimeLine.MainSequence.Count
If osld.TimeLine.MainSequence(C).Shape.Id = recnewShp.Id Then
X = X + 1
Set oeff = osld.TimeLine.MainSequence(C)
Select Case X
Case Is = 1
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = 4
Case Is = 2
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = 5
Case Is = 3
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = 6
End Select
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
recnewShp.Name = "Rectangle 2"
End If
Next C
End Sub
Make sure the shape is named Rectangle 1.