在 VBA 中,我们有ActivePresentation
. 我想知道我们如何在 VB.NET 中做同样的事情。
我有以下代码
Dim oApp As PowerPoint.Application
Dim oPres As PowerPoint.Presentation = oApp.ActivePresentation
我的问题是我们如何在 VB.NET 中声明或使用 ActivePresentation。
任何人都可以帮助我如何ActivePresentation
在 VB.NET 中使用。
首先,您需要声明oApp
为New
应用程序,以创建 PowerPoint 的新实例。
这是必需的,因为您的代码不像使用 VBA 那样在“内部”PowerPoint 中运行。
之后,您需要打开一个演示文稿(或创建一个新演示文稿),然后可以通过ActivePresentation
.
Dim oApp As New PowerPoint.Application
oApp.Presentations.Open("C:\test.pptx")
Dim oPres As PowerPoint.Presentation = oApp.ActivePresentation
您还可以同时打开多个演示文稿,它们可以通过名称寻址:
Dim oPres As PowerPoint.Presentation = oApp.Presentations("test.pptx")
...或索引(以 1 开头):
Dim oPres As PowerPoint.Presentation = oApp.Presentations(1)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句