none
PowerPoint VBA reference: How to add a Disappear or Fade-Out Animation? RRS feed

  • Question

  • Hello,

    The PowerPoint VBA reference contains instructions on how to add an "appear" animation (also called 'effect'). However, in the list of animation enums, there isn't a "disappear" animation. 

    The same is true for fade animation. Only instructions and an enum for the fade-in animation exists, no fade-out.

    See here for complete list of effects: https://msdn.microsoft.com/en-us/library/office/aa211626(v=office.11).aspx

    Can you please instruct me on how to make a fade animation to fade-out, and an appear animation to disappear?

    Thank you,

    Roman

    Monday, January 16, 2017 9:17 AM

Answers

  • Hi,

    Set its effectId into msoAnimEffectAppear/msoAnimEffectFade, then set Exit into msoTrue, then we would get the Exit animation: disappear/fade out .

    E.g.

    Sub AddAnimation()
        Dim sldActive As Slide
        Dim shpSelected As Shape
        Dim ef As Effect
        Set sld = ActivePresentation.Slides(1)
        Set shp = ActivePresentation.Slides(1).Shapes(1)
       Set ef = sld.TimeLine.MainSequence.AddEffect(Shape:=shp, effectId:=msoAnimEffectFade)
    ef.Exit = msoTrue
    End Sub

    Regards,

    Celeste



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 17, 2017 5:34 AM
    Moderator

All replies

  • Hi,

    Set its effectId into msoAnimEffectAppear/msoAnimEffectFade, then set Exit into msoTrue, then we would get the Exit animation: disappear/fade out .

    E.g.

    Sub AddAnimation()
        Dim sldActive As Slide
        Dim shpSelected As Shape
        Dim ef As Effect
        Set sld = ActivePresentation.Slides(1)
        Set shp = ActivePresentation.Slides(1).Shapes(1)
       Set ef = sld.TimeLine.MainSequence.AddEffect(Shape:=shp, effectId:=msoAnimEffectFade)
    ef.Exit = msoTrue
    End Sub

    Regards,

    Celeste



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 17, 2017 5:34 AM
    Moderator
  • Hi Celeste,

    Thank you for the reply. Your solution works perfectly!

    Best,

    Roman

    Sunday, January 29, 2017 12:27 PM