Reputation: 3519
I have been following the tutorial for adding the add-ins ribbon to Outlook. In my project I have MyRibbon.vb and MyRibbon.xml. I have edited MyRibbon.xml so there is a button that says "Green Print".
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon>
<tabs>
<tab idMso="TabAddIns">
<group id="MyGroup"
label="My Group">
<button id="printButton" label="Green Print" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
In MyRibbon.vb I have added some code which I was hoping would display a message saying "Hello World" when the button is clicked:
#Region "Ribbon Callbacks"
'Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226
Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
Me.ribbon = ribbonUI
End Sub
Public Sub OnActionCallback(ByVal control As Office.IRibbonControl,
ByVal isPressed As Boolean)
If (control.Id = "printButton") Then
MsgBox("Hello World!")
End If
End Sub
#End Region
However when I click on the Green Print button in the add-ins ribbon nothing happens - no error message or anything just nothing. Where am I going wrong please?
Upvotes: 1
Views: 639
Reputation: 5834
You are missing the pointer to the callback in your XML. Use:
<button id="printButton" label="Green Print" onAction="OnActionCallback"/>
Upvotes: 1