Populate 2 custom Ribbon Dropdowns using only 1 callback function

Luthius

Active Member
Joined
Apr 5, 2011
Messages
324
Guys
I added 2 dropdown controls on my custom ribbon.
DropDownCategory (dynamic)
DropDownSubCategory (dynamic)

Dynamic means that the list can increase as soon a new item is added.
I would like to create just one callback function to populate these 2 dropdowns.
I'm using getItemLabel="PopulateDropDown" for both in the xml syntax.

I tried the following code for my callback function but without success because it is only populating the first CASE of my SELECT CASE.
Can someone advise me please?

VBA Code:
Sub PopulateDropDown(control As IRibbonControl, index As Integer, ByRef label)
    Dim ActiveCategory As Variant
    Dim ActiveSUBCategory As Variant
    ActiveCategory = GetCategories()
    ActiveSubCategory = GetSUBCategories()
    Select Case control.ID
        Case "DropDownCategory "
            label = ActiveCategory (index)
        Case "DropDownSubCategory "
            label = ActiveSUBCategory (index) + 1
    End Select
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,687
Messages
6,126,204
Members
449,298
Latest member
Jest

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top