Outlook 2013-VBA-功能区-无法启动onLoad [英] Outlook 2013 - VBA - Ribbon - onLoad not firing

查看:178
本文介绍了Outlook 2013-VBA-功能区-无法启动onLoad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

%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

但是,DoItDoIt2均不会运行.如果我从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:

  • 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屋!

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