vba 如何在退出动画结束后自动推进 PowerPoint 幻灯片?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9245340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 12:34:17  来源:igfitidea点击:

How to auto advance a PowerPoint slide after an exit animation is over?

vbapowerpointpowerpoint-vba

提问by joooc

PowerPoint entrance animation set up with "Start: With Previous" starts right when a new slide is advanced. However, if you set up an exit animation in the same way, it doesn't start with a slide ending sequence. Instead, the "Start: On Click" trigger needs to be used and after your exit animation is over you still need one extra click just to advance to the next slide.

使用“开始:与上一个”设置的 PowerPoint 入口动画会在新幻灯片前进时立即开始。但是,如果您以相同的方式设置退出动画,则它不会以幻灯片结束序列开始。相反,需要使用“开始:点击”触发器,在退出动画结束后,您仍然需要额外点击一次才能前进到下一张幻灯片

Workarounds to this are obvious: create a duplicate slide, make your ending animations from the original slide being your starting animations on the duplicate slide and let them be followed with whatever you want or create a transition slide with those ending animations only and set up "Change Advance slide -> Automatically after -> [the time it takes your animations to finish]".

解决方法很明显:创建一个重复的幻灯片,将原始幻灯片的结束动画作为复制幻灯片上的开始动画,然后随心所欲地跟随它们,或者仅使用这些结束动画创建过渡幻灯片并进行设置“更改前进幻灯片 -> 之后自动 -> [完成动画所需的时间]”。

These workarounds will make it work for your audience, visually. However, it has an impact on slide numbers you might need to adjust accordingly and/or duplicate content changes. If you are the only one creating and using your presentation, this might be just fine. But if you are creating a presentation in collaborative mode with three other people and don't even know who will be the presenter at the end, you can mess things up.

这些解决方法将使其在视觉上为您的观众服务。但是,它会影响您可能需要相应调整和/或重复内容更改的幻灯片编号。如果您是唯一一个创建和使用演示文稿的人,这可能就好了。但是,如果您正在与其他三个人以协作模式创建演示文稿,并且甚至不知道最后谁将成为演示者,那么您可能会把事情搞砸。

Let's be specific: most of my slides have 0.2s fly in entrance animation applied to blocks of content coming from right, bottom or left. Advancing to the next slide I want them to fly out in another 0.2s exit animation being followed by new slide 0.2s fly in entrance animation of the new blocks. The swapping of the blocksshould be triggered while advancing to the next slide, as usually.
As mentioned, I'm not able to achieve this without one extra click between the slides.

让我们具体一点:我的大部分幻灯片都有 0.2 秒的入口动画,应用于来自右侧、底部或左侧的内容块。前进到下一张幻灯片,我希望它们在另一个 0.2 秒的退出动画中飞出,然后是新幻灯片 0.2 秒在新块的入口动画中飞出。像往常一样,在前进到下一张幻灯片时应该触发交换
如前所述,如果没有在幻灯片之间额外单击一下,我将无法实现这一目标。

I wrote a VBA scriptthat should start together with an exit animation and will auto advance a slide after 0.3s when the exit animation is over. That way I should get rid of those extra clicks which are needed right now.

我写了一个VBA 脚本,它应该与退出动画一起开始,并在退出动画结束后 0.3 秒后自动推进幻灯片。这样我应该摆脱那些现在需要的额外点击。

Sub nextslide()
iTime = 0.3
Start = Timer
While Timer < Start + iTime
DoEvents
Wend
With SlideShowWindows(1).View
    .GotoSlide (ActivePresentation.SlideShowWindow.View.Slide.SlideIndex + 1)
End With
End Sub

It works well when binded on a box, button or another object. But I can't make it run on a single click (anywhere on the slide)so that it could start together with the exit animation onclick trigger. Creating a big transparent rectangular shape over the whole slide and binding the macro on it doesn't help either. By clicking it you only get the macro running, exit animation is not triggered.
Anyway, I don't want to bind the macro to any other workaround object but the slide itself.

当绑定在框、按钮或其他对象上时,它运行良好。但是我不能让它在单击(幻灯片上的任何地方)时运行,以便它可以与退出动画 onclick 触发器一起启动。在整个幻灯片上创建一个大的透明矩形并在其上绑定宏也无济于事。通过单击它,您只会运行宏,不会触发退出动画。
无论如何,我不想将宏绑定到任何其他解决方法对象,但幻灯片本身。

Anyone knows how to trigger a PowerPoint VBA script on slide onclick event?
Anyone knows a secret setting that will make the exit animation work as expected i.e. animating right before exiting a slide while transitioning to the next one?
Anyone knows how to beat this dragon?

任何人都知道如何在幻灯片 onclick 事件上触发 PowerPoint VBA 脚本?
任何人都知道一个秘密设置,可以使退出动画按预期工作,即在退出幻灯片之前同时过渡到下一个幻灯片时动画?
有谁知道怎么打这个龙?

Thank you!

谢谢!

回答by Tom Pizzato

You could also set the TRANSITIONS (tab) -> Advance Slide After 00:00:00 seconds. You will need to set the SLIDESHOW (tab) to Use (Rehearsal) Timings. This will automatically advance the slide after the last animation action. You could, of course give it some seconds to wait, but it sounds like you just want to advance the slide.

您还可以设置 TRANSITIONS(选项卡)-> 00:00:00 秒后前进幻灯片。您需要将幻灯片(选项卡)设置为使用(排练)计时。这将在最后一个动画动作后自动推进幻灯片。当然,您可以给它几秒钟的等待时间,但听起来您只想推进幻灯片。

回答by Bruno Leite

You can intercept events in powerpoint using class module

您可以使用 class 模块拦截 powerpoint 中的事件

In Class Module

课堂模块

In left combo (object) in VBA Explorer you can see ppt and in right your events

在 VBA 资源管理器的左侧组合(对象)中,您可以看到 ppt,右侧则是您的事件

Private WithEvents ppt As PowerPoint.Application

In common module use

常用模块使用

set x= new class1

Now you can use all events of presentation.

现在您可以使用所有演示事件。

[]'s

[] 的

回答by Bhavesh Shaha

OnSlideShowPageChange: VBA working while going to a slide without pressing any button

OnSlideShowPageChange:VBA 在不按任何按钮进入幻灯片时工作

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = SSW.Presentation.Slides(x).SlideIndex Then
'PUT CODE HERE
End If
End Sub