Outlook 2013 - VBA - Ribbon - onLoad not working
In %appdata%\Microsoft\Office\olkapptitem.officeUI
I have:
<?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>
In Outlook, in a 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
However, neither will be executed DoIt
, either DoIt2
. If I select options from DoIt2
, then when I click the button it starts, but not vice versa.
Any help is appreciated.
You cannot define ribbon callbacks in VBA. You need to develop an add-on if you want to customize the Ui ribbon using callbacks. Outlook, unlike any other Office application, does not support customizing the Ribbon UI with VBA.
The Ribbon UI is detailed in the following articles on MSDN:
- Customizing the Office 2007 Developer Checkbox (Part 1 of 3)
- Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
- Customizing the 2007 Fluent Ribbon for Developers (Part 3 of 3)