我想在PowerPoint上使用VBA在形状上添加进入效果和退出效果。 我似乎无法正确理解这一点,这方面的文档很糟糕甚至不存在。
有人可以帮助我吗?如果有人能给我一个此类代码的示例,那就太好了。
我尝试过各种变化:
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
属性决定动画效果是否为退出效果。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
微软文档: