excel - VBA Excel 到 Powerpoint,向前移动 1 张幻灯片
问题描述
我正在尝试创建一个打开应用程序的宏,然后向前移动一张幻灯片并使其成为我的活动幻灯片。我觉得有一个简单的解决方案,但我似乎无法找到一个代码来让我前进一张幻灯片。到目前为止我有
Private Sub OpenPowerpoint()
' Opens Presentation.pptx
Dim PPT As PowerPoint.Application
Set PPT = New PowerPoint.Application
PPT.Visible = True
PPT.Presentations.Open Filename:="C:\Users\Person\Desktop\Test\Template.pptx"
End Sub
在第一张幻灯片上打开我的 pp。
解决方案
Window.View.GoToSlide
将让您转到特定的幻灯片编号。
Window.View.Slide.SlideIndex
会告诉您当前所在的幻灯片编号。
Presentation.Slides.Count
将告诉您演示文稿中有多少张幻灯片,这样您就不会试图移动到最后。
把它放在一起:
Private Sub OpenPowerpoint()
' Opens Presentation.pptx
Dim PPT As PowerPoint.Application, PPP As PowerPoint.Presentation, PPW As Object
Set PPT = New PowerPoint.Application
PPT.Visible = True
Set PPP = PPT.Presentations.Open(FileName:="C:\Users\Person\Desktop\Test\Template.pptx")
Set PPW = PPP.Windows(PPP.Windows.Count)
'If there are more slides, go to the next one
If PPW.View.Slide.SlideIndex < PPP.Slides.Count Then PPW.View.GotoSlide PPW.View.SlideIndex + 1
End Sub
推荐阅读
- javascript - 流类型的 PhpStorm 无法识别 React.Node
- linker - 位置计数器不变
- asp.net-mvc-5 - PasswordSignInAsync 返回 Success 而不是 RequiresVerification
- reactjs - 如何在 IIS 上部署 React route 4
- python - 在Python中获取线性回归中每一行的系数
- python - django; 如何在没有模板的情况下创建视图(函数)
- javascript - 非破坏性地拼接 JavaScript
- android - 无法读取多个文件
- ios - 使用swift在UiStackview中设置UiLabel的高度
- typescript - 在 Typescript 中扩展具有泛型接口的泛型类