PowerPoint VBA,使用 VBA 制作进入效果和退出效果的动画/动画 - 请帮助 - 我被卡住了

问题描述 投票:0回答:1

我想在PowerPoint上使用VBA在形状上添加进入效果和退出效果。 我似乎无法正确理解这一点,这方面的文档很糟糕甚至不存在。

有人可以帮助我吗?如果有人能给我一个此类代码的示例,那就太好了。

我尝试过各种变化:

`子 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

结束子`

excel vba powerpoint
1个回答
0
投票

请尝试一下。

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:=msoAnimEffectBox, _
            trigger:=msoAnimTriggerOnPageClick)
        .EffectParameters.Direction = msoAnimDirectionIn
        .Exit = True
    End With
End Sub
© www.soinside.com 2019 - 2024. All rights reserved.