Results 1 to 9 of 9

Thread: Trigger animation delay to 2nd animation also in a shape using powerpoint vba

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Thanks Sir. Shape animation works perfectly as i wanted.
    When i apply for more shape through loop it generate only one shape(ie pentagon6) but animation works perfectly.I want to generate & apply for another 15 shape. so where i do wrong?

    Sub addAnnimation()
    Dim oeff As Effect
    Dim C As Long
    Dim j 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(2)
    For j = 5 To 20 'want to create 15 more shape like pentagon5 (ie pentagon6,pentagon7,......pentagon20)
    Set shp = osld.Shapes("pentagon" & j)
    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)
    If shp.HasTextFrame Then
    recnewShp.TextFrame.TextRange = shp.TextFrame.TextRange

    End If
    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 = (j - 4) * 4.5
    Case Is = 2
    oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
    oeff.Timing.TriggerDelayTime = (j - 3) * 4.5
    Case Is = 3
    oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
    oeff.Timing.TriggerDelayTime = (j - 3) * 4.5
    Case Is = 4
    oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
    oeff.Timing.TriggerDelayTime = (j - 2) * 4.5
    Case Is = 5
    oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
    oeff.Timing.TriggerDelayTime = (j - 1) * 4.5
    End Select
    oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
    recnewShp.Name = "pentagon" & j + 1
    End If
    Next C
    Next j
    End Sub
    Last edited by dibyendu2280; 09-06-2020 at 01:21 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •