将 PowerPoint 加载项中的宏添加到功能区 [英] Adding a macro from PowerPoint add-in to ribbon

查看:86
本文介绍了将 PowerPoint 加载项中的宏添加到功能区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以从功能区中启用宏的 PowerPoint (pptm) 演示文稿中添加宏,方法是右键单击功能区并选择从以下位置选择命令:宏.

It's possible to add macros from a macro-enabled PowerPoint (pptm) presentation from the ribbon by right clicking in the ribbon and selecting Choose commands from: Macros.

我希望它随时可用,所以我将 pptm 文件保存为加载项 (ppam) 并加载了加载项.

I want this to be available at any time, so I've saved the pptm file as an add-in (ppam) and loaded the add-in.

但是,我发现无法从功能区中的加载项添加宏.如何才能做到这一点?我是否需要以某种方式从 Auto_Open 或类似的东西注册所有可用的订阅:

However, I find that it is not possible to add the macro from the add-in in the ribbon. How can this be done? Do I somehow need to register all available Subs from Auto_Open or similar with something like:

Sub MyCommand()
MsgBox "This worked"
End Sub

Sub Auto_Open()
' Magic code allowing me to add the above to the ribbon
End Sub

谢谢!特洛伊尔

推荐答案

您需要将特殊的 XML 代码添加到 PPTM 文件中,以制作您想要的功能区 mod,并将按钮点击挂钩到文件中的 VBA 例程.初学者的谷歌Ribbon XML"(不带引号).有几个不错的免费应用程序可以帮助创建/编辑 Ribbon XML.

You need to add special XML code to the PPTM file to make the ribbon mods you want and hook the button clicks to the VBA routines in the file. Google "Ribbon XML" (without quotes) for starters. There are a couple of decent free apps that help create/edit Ribbon XML.

Fernando Andreu 提供的免费 Office RibbonX 编辑器(可在 GitHub 上获得)是一个不错的起点:https://github.com/fernandreu/office-ribbonx-editor/ (或最新版本:https://github.com/fernandreu/office-ribbonx-editor/releases/latest )

The free Office RibbonX Editor by Fernando Andreu, available on GitHub is a good place to start: https://github.com/fernandreu/office-ribbonx-editor/ (or for the latest release: https://github.com/fernandreu/office-ribbonx-editor/releases/latest )

Ron DeBruin 在此处提供了大量有关使用 RibbonX 的信息:https://www.rondebruin.nl/win/s2/win001.htm

Ron DeBruin has a wealth of information about using RibbonX here: https://www.rondebruin.nl/win/s2/win001.htm

我关于这个主题的圣经是 Robert Martin、Ken Puls 和 Teresa Hennig(Wiley 是出版商)的 RibbonX.在亚马逊上有售.

My bible on the subject has been RibbonX by Robert Martin, Ken Puls and Teresa Hennig (Wiley is the publisher). Available on Amazon.

这篇关于将 PowerPoint 加载项中的宏添加到功能区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆