I have several autotext entries saved in a template add-in. In another template’s userform, I have a combobox that populates from the specified autotext entries in the add-in template (i.e. based on category). This works fine, except I want them to sort alphabetically and to display the first item on the list in the combobox. Currently, using the following code, the combobox displays blank and I have to click the down-arrow to see the entries. Also, they are not sorted, rather, they are in the order in which I created them.
This is the code I’m using:
Set MyTemplate = Templates(CorpStartTemp)
Dim objDistList As BuildingBlock
For i = 1 To MyTemplate.BuildingBlockTypes(wdTypeAutoText).Categories(“DistLists”).BuildingBlocks.Count
Set objDistList = MyTemplate.BuildingBlockTypes(wdTypeAutoText).Categories(“DistLists”).BuildingBlocks(i)
ToDlg.cboDistLists.AddItem objDistList.Name
Next i
CorpStartTemp – is my startup template
ToDlg – is the form name in the other template
cboDistList – is the name of the combobox control
Can anyone help with (1) sorting them alphabetically, and (2) defaulting to display the first name in the list?
Thanks…
Adri