【问题标题】:Developing a custom ribbon add-in for PowerPoint (Office 365) Mac为 PowerPoint (Office 365) Mac 开发自定义功能区加载项
【发布时间】:2020-01-04 02:03:47
【问题描述】:

我最近从我的 Windows 工作笔记本电脑切换到 Mac,我通过 PowerPoint 插件安装了一些不错的功能,我想复制这些功能。

我的所有宏都在工作,我现在正试图将它们变成一个可以在我的机器上加载的工作插件。

现在,在我们开始签署加载项和 bla bla bla 的棘手部分之前,我开始非常简单(带有自定义工具栏的 pptm 文件)。我关注了ron de bruin's amazing guide。但是,当我在 Mac 上启动演示文稿时(在 Windows 上它们可以工作),按钮不会触发宏(无论是什么宏)。

这是 customUI.xml 文件的内容

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon>
    <tabs>
      <tab id="MyCustomTab" label="My Tab" insertAfterMso="TabHome">

      <group id="customGroup1" label="Group 1">
          <button id="customButton1" label="Caption 1" size="normal" onAction="Macro1" imageMso="Cut" />        
          <button id="customButton2" label="Caption 2" size="normal" onAction="Macro2" imageMso="Bold" />
          <button id="customButton3" label="Caption 3" size="normal" onAction="Macro3" imageMso="Italic" />
        </group>

      </tab>
    </tabs>
  </ribbon>
</customUI>

这是我的宏模块在 VBA 中的内容:

Option Explicit

'Callback for customButton1 onAction
Sub Macro1(control As IRibbonControl)
    MsgBox "This is macro 1"
End Sub

'Callback for customButton2 onAction
Sub Macro2(control As IRibbonControl)
    MsgBox "This is macro 2"
End Sub

'Callback for customButton3 onAction
Sub Macro3(control As IRibbonControl)
    MsgBox "This is macro 3"
End Sub

知道我做错了什么吗?

【问题讨论】:

  • 猜猜看,是否还有其他打开的文档可能有Macro1,您可以尝试使用唯一的名称吗?喜欢CBTest190831
  • 另外,代码可以在mac上编译吗?你在 mac 上使用的是什么版本的 Office?
  • 嗨,我使用的是 19081202 版本。我尝试了一个唯一的名称,但没有成功。

标签: vba macos powerpoint ribbon office-addins


【解决方案1】:

我可以确认 PowerPoint for Mac 中 XML 和 VBA 回调之间的连接已断开。使用您的示例 XML 和 VBA,我在 PowerPoint、Word 和 Excel 启用宏的文件中创建了相同的功能区模块。这三个都在 Windows 中按预期工作。只有 Word 和 Excel 在 Office 2019 for Mac 中按预期工作。

我已使用程序窗口右上角的 smailey-face 图标向 Microsoft 报告了此错误。

【讨论】:

    【解决方案2】:

    我已通过在“安全和隐私”中设置以下首选项来(暂时)解决该问题:
    * 宏安全 > 全部启用
    * 信任对 VBA 项目对象模型的访问
    * 允许操作在没有通知的情况下运行程序

    希望这会有所帮助

    【讨论】:

    • 感谢您提及这一点,但除了网络安全专家之外,我不会向任何人推荐这些设置。
    • 奇数。我去测试你的设置,功能区模块在不更改任何设置的情况下运行宏。一定是满月……
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多