【问题标题】:Excel 2007 VBA to close powerpoint slideshow, but leave powerpoint application openExcel 2007 VBA 关闭 powerpoint 幻灯片,但保持 powerpoint 应用程序打开
【发布时间】:2015-08-17 21:36:18
【问题描述】:

我有一个 Excel 文件,它需要能够在 excel 工作表和 powerpoint 幻灯片之间无缝移动(对用户)。我已经能够很好地完成这项工作,但如果我有一个命令来简单地关闭正在运行的 powerpoint 幻灯片,而不是关闭 powerpoint 本身,它可能会更好地工作(因为这样可以更快更好地进行开始下一个 PowerPoint 幻灯片放映)。我目前正在使用此代码:

Sub ViewVideo()
        Application.ScreenUpdating = False
        Dim PPApp As Object


        Set PPApp = CreateObject("Powerpoint.Application")
        PPApp.Visible = True
        PPApp.Presentations.Open ThisWorkbook.Path & VideoName
        Application.Wait (Now + TimeValue(Delay))

        PPApp.Quit

        Application.WindowState = xlMaximized
        ActiveWindow.WindowState = xlMaximized

End Sub

但是,这会关闭 Powerpoint 应用程序,而不仅仅是幻灯片。我可以使用其他命令吗?

最好的问候 克里斯托弗

【问题讨论】:

    标签: excel vba slideshow


    【解决方案1】:

    您可以使用相同的 .Presentations 但之后使用 .close

    见下面的代码:

    PPApp.Presentations(videoName).Close
    

    只要 videoName 被正确定义或获得正确的文件名字符串,这当然可以工作,请参见下面的示例:

    videoName = "test.pptx"
    

    【讨论】:

      猜你喜欢
      • 2022-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多