Outlook 2013-VBA-功能区-无法启动onLoad [英] Outlook 2013 - VBA - Ribbon - onLoad not firing
问题描述
在%appdata%\Microsoft\Office\olkapptitem.officeUI
中,我有:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="DoIt">
<ribbon startFromScratch="false">
<tabs>
<tab idMso="TabMail">
<group id="group1" label="Hazaa!">
<button id="one" onAction="DoIt2" label="hi" visible="true"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
在Outlook的VBA编辑器中,我有一个名为Module1的模块,该模块具有:
In Outlook, in the VBA editor, I have a module called Module1 that has:
Option Explicit
Sub DoIt(ribbon As IRibbonUI)
MsgBox "hi"
End Sub
Sub DoIt2(control As IRibbonControl)
MsgBox "bye"
End Sub
但是,DoIt
或DoIt2
均不会运行.如果我从DoIt2
中取出参数,则当我单击按钮时它将运行,但反之则不会.
However, neither DoIt
or DoIt2
will run. If I take out the parameters from DoIt2
then when I click the button it will run, but not the other way.
感谢您的帮助.
推荐答案
您无法在VBA中定义功能区回调.如果要使用回调来自定义Ribbon Ui,则需要开发一个外接程序.与其他Office应用程序不同,Outlook不支持使用VBA自定义功能区UI.
You can't define ribbon callbacks in VBA. You need to develop an add-in if you want to customize the Ribbon Ui using callbacks. Outlook, unlike any other Office application, doesn't support customizing the Ribbon UI using VBA.
Ribbon UI在MSDN的以下系列文章中有详细介绍:
The Ribbon UI is described in depth in the following series of articles in MSDN:
- 为开发人员自定义2007 Office Fluent功能区( 3之1)
- 为开发人员自定义2007 Office Fluent功能区( 3之2)
- 为开发人员自定义2007 Office Fluent功能区( 3之3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
这篇关于Outlook 2013-VBA-功能区-无法启动onLoad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!