I want to add an entry effect and exit effect on a shape using VBA on PowerPoint. I can't seem to get this right the documentation on this is bad to nonexistent.
Can someone please help me, if someone can just give me an example of this type of code that would be great.
I have tried all sorts of variations:
Sub newanimate_3()
Dim PPSlide As Slide ' We need the slide object
Dim tronShape As Shape
' Make sure a slide is selected
Set PPSlide = ActiveWindow.View.Slide
Set tronShape = PPSlide.Shapes("cur_1")
' Set the properties for the added picture
With tronShape
' Set the position and size of the picture
' You may need to adjust these values based on your requirements
'.Left = 100
'.Top = 100
'.Width = 200
'.Height = 150
' Animate the picture
With .AnimationSettings
.EntryEffect = ppEffectFlyFromRight
.AnimationOrder = ppAfterPrevious
.AdvanceMode = ppAdvanceOnTime
.AdvanceTime = 5 ' Start after 5 seconds
End With
End With
End Sub
Effect.Exit
property determines whether the animation effect is an exit effect.Sub demo()
Dim PPSlide As Slide ' We need the slide object
Dim tronShape As Shape
Set PPSlide = ActiveWindow.View.Slide
Set tronShape = PPSlide.Shapes(1) ' modify as needed
With tronShape.AnimationSettings
.EntryEffect = ppEffectFlyFromRight
.AnimationOrder = ppAfterPrevious
.AdvanceMode = ppAdvanceOnTime
.AdvanceTime = 1 ' Start after 5 seconds
End With
With PPSlide.TimeLine.MainSequence.AddEffect(Shape:=tronShape, _
effectId:=msoAnimEffectCircle, _
trigger:=msoAnimTriggerOnPageClick)
.EffectParameters.Direction = msoAnimDirectionIn
.Exit = True
End With
End Sub
Microsoft documentation: