gpt4 book ai didi

excel - 如何获取 Excel VBA 中打开的 powerpoint 演示文稿的处理程序

转载 作者:行者123 更新时间:2023-12-02 17:01:24 24 4
gpt4 key购买 nike

我正在尝试获取 Powerpoint 演示文稿的处理程序。通常,我使用以下指令:

Set pres = PowerPoint.application.Presentations(pptFile)

我收到以下错误消息:

'an activex component can't create object'

pptFile is supposed to be already open

有什么想法吗?

最佳答案

如果您不想打开同一个演示文稿两次,如下所示:

Dim pptFile As String
pptFile = "C:\Users\" & Environ$("username") & "\Desktop\ppp.pptx"

Dim pptApp As PowerPoint.Application
Set pptApp = New PowerPoint.Application

Dim pres As Presentation

For Each pres in pptApp.Presentations
If pres.FullName = pptFile then
' found it!
Exit For
End If
End If

' And possibly do this to open the file if it's not already open
If pres Is Nothing Then
Set pres = pptApp.Presentations.Open(pptFile)
End If

关于excel - 如何获取 Excel VBA 中打开的 powerpoint 演示文稿的处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20283412/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com