VBA选择第一页的PPT
时间: 2023-07-21 13:41:18 浏览: 156
您可以使用以下代码选择 PowerPoint 中的第一页:
```
Sub SelectFirstSlide()
Dim PPTApp As PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim PPTSlide As PowerPoint.Slide
'Create a PowerPoint application object
Set PPTApp = New PowerPoint.Application
'Open the PowerPoint presentation
Set PPTPres = PPTApp.Presentations.Open("C:\Presentation.pptx")
'Select the first slide
Set PPTSlide = PPTPres.Slides(1)
PPTSlide.Select
'Close the PowerPoint presentation
PPTPres.Close
'Quit the PowerPoint application
PPTApp.Quit
'Release the objects from memory
Set PPTSlide = Nothing
Set PPTPres = Nothing
Set PPTApp = Nothing
End Sub
```
请将 "C:\Presentation.pptx" 替换为您的 PowerPoint 文件的完整路径。
阅读全文