Consulting

Results 1 to 2 of 2

Thread: Powerpoint Macros for flying in at 0.25 speed

  1. #1
    VBAX Newbie
    Joined
    Jul 2019
    Posts
    1
    Location

    Powerpoint Macros for flying in at 0.25 speed

    Hi, what would the code be for a macro to change the animation of a selected item to flying in and change the speed to 1 second.

    Thanks!

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,843
    Location
    This assumes that the selected shape is already animated and it's the first animation you want to change:

    Sub change_to_fly()
        Dim oshp As Shape
        Dim osld As Slide
        Dim oeff As Effect
        On Error Resume Next
        Set oshp = ActiveWindow.Selection.ShapeRange(1)
        If Not oshp Is Nothing Then
            Set osld = oshp.Parent
            Set oeff = osld.TimeLine.MainSequence.FindFirstAnimationFor(oshp)
            With oeff
                .EffectType = msoAnimEffectFly
                .EffectParameters.Direction = msoAnimDirectionLeft
                .Timing.Duration = 0.25
            End With
        End If
    End Sub
    To ADD the effect to an unanimated shape change the 'set oeff' line to

    Set oeff = osld.TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectFly, , msoAnimTriggerOnPageClick)
    Last edited by John Wilson; 07-02-2019 at 06:53 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

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
  •