I made a custom ribbon in Word, that has a ComboBox. I want to populate that ComboBox with items, using a VBA macro. The problem is that seemingly the ComboBox can only hold 1000 items. When I try to put more than 1000 items, I only see an empty ComboBox.
How can I overcome this?
(I am aware that this could be overcome with a userform, but working from the ribbon would be way better.)
Here is my xml code:
<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="Ribbon_Load">
<ribbon >
<tabs >
<tab
id="Tab1"
label="CustomTab">
<group id="Group1"
label="CustomGroup" >
<comboBox
id="comboBox1"
label="Elements:"
sizeString="WWWWWWWWWWWWWWWWWWWWWWWW"
getItemID="getElementID"
getItemLabel="getElementLabel"
getItemCount="getElementCount"/>
</group>
</tab >
</tabs >
</ribbon >
</customUI >
and my code in VBA:
Dim myRibbon As IRibbonUI
Sub Ribbon_Load(ribbon As IRibbonUI)
Set myRibbon = ribbon
ribbon.ActivateTab "Tab1"
End Sub
Sub getElementID(control As IRibbonControl, index As Integer, ByRef id)
id = "ID" & index
End Sub
Sub getElementLabel(control As IRibbonControl, index As Integer, ByRef label)
label = "Element " & index
End Sub
Sub getElementCount(control As IRibbonControl, ByRef returnedVal)
returnedVal = 1000
End Sub
If the returnedVal value is 1001 or more, the ComboBox is empty.