HI,
I have added couple controls on ribbon bar of excel,
1. A button control
2. A drop down list
On Button click can I change the value in Drop down list ?
Thanks for your reply....
HI,
I have added couple controls on ribbon bar of excel,
1. A button control
2. A drop down list
On Button click can I change the value in Drop down list ?
Thanks for your reply....
Had to use quotes as Sucuri was blocking reply.
You would need to use the "onLoad" routine to store a reference to the ribbon interface
You can then use the Invalidate method which would trigger a callback associated with the dropdown.
Thanks for rep...
I have created something like this ...
'Callback for customUI.onLoad
Dim MyRibbonExcel As IRibbonUI
'Callback for customUI.onLoad
Sub onLoadRibbon(ribbon As IRibbonUI)
Set MyRibbonExcel = ribbon
End Sub
'Callback for Button1 onAction
Sub onActionButton(control As IRibbonControl)
Module1.MyRibbonExcel.InvalidateControl ("dropDownID")
End Sub
'Callback for dropDownID getSelectedItemIndex
Sub getSelectedItemIndex_dropDown(control As IRibbonControl, ByRef returnedVal)
returnedVal = 2
End Sub
'Callback for dropDownID onAction
Sub OnActionDropDown(control As IRibbonControl, id As String, index As Integer)
End Sub
When ever I click the button it is calling "getSelectedItemIndex_dropDown" method and value of drop is changing to 2, excellent. But the same method is called when opening the document, how to solve it? thanks for reply. (yes vba updating the ribbon control status)
Last edited by md93150; 02-21-2018 at 10:40 AM.
I'm just a little confused. Would clicking the button being updating the same thing to the dropdown list each time? Or are you planning to have multiple buttons or other to update the drop down list?
I just saw your sample code. Are you doing this all within VBA or anything with RibbonX? Its been a long time since I worked with the ribbonx, but had always thought of it as 'fun' stuff.
Last edited by ptmuldoon; 02-21-2018 at 10:09 AM.
When first loaded the callbacks will fire, same as invalidate.
You need to add code to determine what to do under what circumstances.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks