简体   繁体   English

无法从 Excel 打开 Powerpoint 演示文稿

[英]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.

相关问题 使用 VBA 从 Excel 中打开 PowerPoint 演示文稿,然后将该演示文稿设置为变量 - Open a PowerPoint presentation from Excel with VBA and then set that presentation to a variable 从 PowerPoint 演示文稿(VBA、powerpoint)打开 Excel 文档 - Open Excel document from a powerpoint presentation (VBA, powerpoint) 使用VBA从Excel复制到打开的Powerpoint演示文稿 - Using VBA to copy from Excel to an open Powerpoint presentation 无法使用 VBA 从 Excel 打开现有的 PowerPoint 演示文稿 (2016) - Unable to open an existing PowerPoint Presentation (2016) from Excel using VBA 从Excel创建PowerPoint演示文稿 - Create PowerPoint presentation from Excel Excel VBA无法在Office 2016中保存为嵌入式PowerPoint演示文稿 - Excel VBA Can't SaveAs Embedded PowerPoint Presentation in Office 2016 打开 Powerpoint 演示文稿并更新 VBA 中的 Excel 链接 - Open a Powerpoint Presentation and update the Excel links in VBA 从 Excel 和 VBA 打开 PowerPoint 演示文稿,而不指定 Excel 文件路径 - Open a PowerPoint presentation from Excel with VBA without specifying Excel file path 在 Excel 中使用 VBA 从 PowerPoint 模板创建新的 PowerPoint 演示文稿 - Create new PowerPoint presentation from PowerPoint template using VBA in Excel 从Excel调用宏以打开PowerPoint演示文稿,插入幻灯片以及将范围复制到幻灯片有时会起作用,但会出错 - Macro called from Excel to Open a PowerPoint Presentation, Insert a Slide, and Copy Range to Slide works sometimes, errors others
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM