[英]Can't open Powerpoint presentation from Excel
I have a file that works fine on my pc running Win XP, Excel 2003. PowerPoint resides in Office 11. Needed to go to another PC same Files but PowerPoint is in Office 10. The file I have "WORKED" fine on mine but will not open PPT presentations on all PC.我有一个文件在我的运行 Win XP、Excel 2003 的电脑上运行良好。PowerPoint 驻留在 Office 11 中。需要转到另一台 PC 相同的文件,但 PowerPoint 在 Office 10 中。我的文件“工作”很好,但会无法在所有 PC 上打开 PPT 演示文稿。 So I need a different way to open them.
所以我需要一种不同的方式来打开它们。 I was using a Shell call to open and that was good.
我正在使用 Shell 调用打开,这很好。 I found a snippet from Ron DeBruin which kind of works.
我从 Ron DeBruin 那里找到了一个片段,这种片段很有效。 It partially fails on the open though.
不过,它在公开场合部分失败了。 Here is the code that is important.
这是重要的代码。 PowerPoint Does open as an application but the file itself does not open IN the Application.
PowerPoint 确实作为应用程序打开,但文件本身不在应用程序中打开。 I get an Automation Error and in the same popup Unspecified Error .
我收到一个自动化错误,并在同一个弹出窗口中出现Unspecified Error 。 Is there a better way for Excel to find where PowerPoint resides and open it that way?
Excel 是否有更好的方法来查找 PowerPoint 所在的位置并以这种方式打开它?
Public Sub Start_Viewer(ProgFile)
Dim objPPT As Object
Dim PrgName As String
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
PrgName = Mid(ProgFile, InStrRev(ProgFile, "\") + 1, InStrRev(ProgFile, ".") - InStrRev(ProgFile, "\") - 1)
objPPT.Presentations.Open FileName:="S:\Lab\EHS\SAFETY\" & PrgName & "\PPT\" & PrgName & ".ppt"
Workbooks.Open FileName:="S:\Lab\EHS\SAFETY\" & PrgName & "\Quizzes\" & PrgName & " Quiz.xls"
End Sub
objPPT.Presentations.Open is the part that fails. objPPT.Presentations.Open是失败的部分。 I added FileName aafter open as I saw it in another post someplace.
我在打开后添加了FileName,因为我在某处的另一篇文章中看到了它。 It fails with or without that.
不管有没有那个,它都会失败。
Original working code for MY PC only.仅适用于我的 PC 的原始工作代码。
Public Sub Start_Viewer(ProgFile)
' This works for PowerPoint in this location only and on my work PC
' It fails on other pcs at work when PowerPoint resides elsewhere.
' ProgFile is the path passed from the calling subroutine _
and opens the PowwerPoint Presentation for that file
RetVal = Shell("C:\Program Files\Microsoft Office\Office\PPTView.exe " & Chr(34) & ProgFile & Chr(34), 1)
Watched = MsgBox("Have you finished the presentation?", vbYesNo, "Verify Presentation Watched")
Select Case 6
' PrgName is JUST the extracted FileName (no path no extension) to give me folder names
PrgName = Mid(ProgFile, InStrRev(ProgFile, "\") + 1, InStrRev(ProgFile, ".") - InStrRev(ProgFile, "\") - 1)
Workbooks.Open FileName:="S:\Lab\EHS\SAFETY\" & PrgName & "\Quizzes\" & PrgName & "Quiz.xls"
Case 7
Exit Sub
End Select
End Sub
您可能需要检查EzPaste以自动执行从 Excel 粘贴到 PPT 的过程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.