【发布时间】: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