I am trying to get the index value from a custom dropdown on my outlook ribbon. On the dropdown I have added several items and several buttons.
<mso:dropDown id="MydropDown"
label="SOLV Tickets"
enabled="true"
getItemCount="Project1.DDItemCount"
getItemLabel="Project1.DDListItem"
getSelectedItemIndex="Project1.DDSelctItemIndx"
onAction="Project1.DDOnAction">
<mso:item id="item" label="Commercial"/>
......
<mso:button id="button1" label="Commercial Interfaces" onAction="Project1.EMAIL_SOLV_Tickets.SOLV_CommercialInterfaces" visible="true" />
......
</mso:dropDown >
The onAction attribute of the buttons has no issue launching macros.
Sub SOLV_Commercial()
SOLV_emailGenerator ("SAP DS.sap-ds-commercial")
End Sub
The onAction attibute of the dropdown itself does not seem to send anything to the sub.
Sub DDOnAction(control As IRibbonControl, ID As String, index As Integer)
MsgBox index
End Sub
I have been able to reproduce the behavior I want in an excel file, outlook seems to be a different animal entirely.
.....on Eugenes advice I have added the code below to outlook's project1 and the attribute getSelecteItemIndex to the dropdown above
Sub DDSelctItemIndx(control As IRibbonControl, ByRef index)
MsgBox index
End Sub
Sub test()
DDSelctItemIndx ????,???
End Sub
Where I am stuck is what to pass for control and index to sub test to see if this works.
Consider using ribbon callbacks for tracking the currently selected index/item for the dropdown control:
getSelectedItemID
- Asks for the item that should be selected by ID.getSelectedItemIndex
- Asks for the item that should be selected by index.If you need to handle button clicks you need to declare the
onAction
attribute for the button control. It has the following signature:Read more about the Fluent UI (aka Ribbon UI) in the following series of articles: