【问题标题】:Slide Selection in PPT on Mac OSMac OS 上 PPT 中的幻灯片选择
【发布时间】:2020-09-24 00:55:39
【问题描述】:

我正在尝试创建一个 VBA 程序来从 excel 中截取屏幕截图并将它们粘贴到 PPT 模板中。我已经能够在 Windows 上取得成功,但我正在努力让它在 MAC 上运行。我知道让 Office 系列产品在 Office for Mac 上相互通信存在问题,但我希望一些旧问题已得到解决。在大多数情况下,关于这个主题的问题是几年前的问题。

我可以使用下面的代码从目录中打开 ppt 模板,但是当我尝试选择特定幻灯片时,excel 会崩溃。这是关于这个主题的最全面的对话,但它来自大约 3 年前。 https://answers.microsoft.com/en-us/msoffice/forum/all/vba-copy-from-mac-excel-2016-and-paste-to/7d177c40-501b-471f-b4b4-81735652d492

我错过了什么愚蠢的东西吗?有解决方法吗?我的组织中有一半使用 PC,一半使用 Mac,因此仅使用 Windows 不是解决方案。

Sub CreateDealReviewPPT()

    'Declare PPT Variables
    Dim PPTApp As PowerPoint.Application
    Dim PPTPres As PowerPoint.Presentation
    Dim PPTSlide As PowerPoint.Slide
    Dim PPTShape As PowerPoint.Shape

    'Ranges for the directories
    PPTTemplate = Sheets("Start Here - ISSP Instructions").Range("PPTTemplate").Value

    Set PPTApp = CreateObject("PowerPoint.Application")
    Set PPTPres = PPTApp.Presentations.Open(PPTTemplate)
        PPTApp.Visible = True
        PPTApp.Activate

    PPTSlide = PPTPres.Slides(5)
    PPTSlide.Select

当我到达 PPTSlide = PPTPres.Slides(5) 时,它崩溃了。

我在 Mac OS Catalina 上。我在 office365 上使用 Excel 和 PPT 版本 16.37。

【问题讨论】:

  • 您缺少Set
  • 错过了。谢谢你。修复后仍会使 Excel 崩溃。

标签: excel vba macos powerpoint


【解决方案1】:

Office for Mac 在 CreateObject 中存在一个长期存在的已知错误。它只是不起作用。

此外,Office for Mac 中的 OLE 实现在 PowerPoint 中受到限制。您可以从 PowerPoint 调用 Excel 和 Word 对象,但不能从 Word 或 Excel 调用 PowerPoint。

最重要的是,2011 年后的 PowerPoint VBA 对象模型充满漏洞:在 Windows 中运行良好的命令和参数在 Mac 上失败。很抱歉,但这是一团糟。

【讨论】:

  • 如果我需要在 Mac 上创建一个将数据从 Excel 移动到 PPT 的程序,我最好的办法是创建 PPT 模板并在 ppt 中创建一个调用 excel 文件的宏吗?或者这也不太可能保持一致?
  • 这应该是可能的,如果你可以避免使用 CreateObject。
猜你喜欢
  • 2023-02-10
  • 2022-06-10
  • 2011-02-27
  • 1970-01-01
  • 1970-01-01
  • 2010-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多