.PPT启用宏的显示路径 [英] .PPT macro-enabled show path

查看:193
本文介绍了.PPT启用宏的显示路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将演示文稿另存为PowerPoint中启用宏的节目,而这样做时我遇到了问题.当我另存为启用宏的演示文稿-但不保存为启用宏的演示文稿时,我正在使用的该代码非常有用:

I am trying to save a presentation as a macro-enabled show in PowerPoint, and I'm running into a problem when I do. This code that I'm using works great when I'm save as a macro-enabled presentation - but not as a macro-enabled show:

Dim oPPTApp As PowerPoint.Application
Dim oPPRFile As PowerPoint.Presentation
Dim oPPTShape As PowerPoint.PlaceholderFormat
Dim oPPTSlide As PowerPoint.Slide

Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = msoTrue

'opening an existing presentation

Dim spath2 As String
Dim strpath2 As String
spath2 = ActivePresentation.Path <--
strpath2 = spath2 + "\Resources\AIT Diplomas\AIT Diplomas.pptx"

问题在于,当我将其保存为支持宏的节目并尝试运行它时,它会停在代码的< ---行,因为没有活动的演示文稿.当将powerpoint保存为宏时启用的放映,然后没有演示文稿"(PowerPoint窗口)打开,只有幻灯片放映窗口.

The problem is that when I save it as a macro-enabled show and try to run it, it stops at the <--- line of code because there "is no active presentation. When you save powerpoint as a macro-enabled show, then no "presentation" (powerpoint window) opens, just the slideshow window.

我需要一种方法来找到不引用不存在的活动表示的活动显示路径.

I need a way of finding the active show path that doesn't reference an activepresentation, which doesn't exist.

谢谢您的时间!

恭喜,达斯汀

推荐答案

由于您尚未回答有关代码在FROM中运行的问题,因此我将假定它来自PPT,并且没有其他问题.涉及的应用程序.在这种情况下,无论是从PPTM还是PPSM都可以正常工作:

Since you haven't answered my question about where the code is running FROM, I'm going to assume that it's from within PPT and that there are no other applications involved. That being the case, this works fine, either from a PPTM or PPSM:

Sub MittedForYourApproval()

' if the code is running within PPT, you don't need to do it this way:
' PPT has a reference to itself.
'Dim oPPTApp As PowerPoint.Application
'Dim oPPRFile As PowerPoint.Presentation
'Dim oPPTShape As PowerPoint.PlaceholderFormat
'Dim oPPTSlide As PowerPoint.Slide

Dim oPPRFile As Presentation
' I don't know where you're going with this
' but PlaceholderFormat <> a shape
Dim oPPTShape As PlaceholderFormat
Dim oPPTSlide As Slide

'Set oPPTApp = CreateObject("PowerPoint.Application")
'oPPTApp.Visible = msoTrue

'opening an existing presentation

Dim spath2 As String
Dim strpath2 As String
spath2 = ActivePresentation.Path '<--
'strpath2 = spath2 + "\Resources\AIT Diplomas\AIT Diplomas.pptx"
MsgBox spath2

End Sub

这篇关于.PPT启用宏的显示路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆