Summer,
I am not really sure which example of mine that you are referencing but
since I am learning bits and pieces everyday things often change ;-). I am
by no means an expert and there is likely a better way. However, this is
how I would go about creating multiple dropdowns in a group.
First I have learned that it seems to be much easier to use call backs as
much as possible for defining the Ribbon. Here is the XML that would create
a custom Tab, with a custom Group, holding four dropdowns. You could add as
many as you want.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="Onload">
<ribbon>
<tabs>
<tab id="CustomTab" getLabel="GetLabel">
<group id="Grp1" getLabel="GetLabel">
<dropDown id="DD1" getLabel="GetLabel" getImage="GetImage"
getItemCount="GetItemCount" getItemLabel="GetItemLabel"
getItemImage="GetItemImage" getSelectedItemIndex="GetSelectedItemIndex"
getItemScreentip="GetItemScreenTip" getItemSupertip="GetItemSuperTip"
onAction="MyDDMacro">
</dropDown>
<dropDown id="DD2" getLabel="GetLabel" getItemCount="GetItemCount"
getItemLabel="GetItemLabel" getSelectedItemIndex="GetSelectedItemIndex"
onAction="MyDDMacro">
</dropDown>
<dropDown id="DD3" getLabel="GetLabel" getItemCount="GetItemCount"
getItemLabel="GetItemLabel" getSelectedItemIndex="GetSelectedItemIndex"
onAction="MyDDMacro">
</dropDown>
<dropDown id="DD4" getLabel="GetLabel" getItemCount="GetItemCount"
getItemLabel="GetItemLabel" getSelectedItemIndex="GetSelectedItemIndex"
onAction="MyDDMacro">
</dropDown>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
The first dropdown is a little souped up with extra features while the other
three contain the bare bones to make them functional.
You will notiice that they all use the same callbacks.
Now in the VBA you simply use the same call backs and the Select Case method
to deal with each control:
Option Explicit
Public myRibbon As IRibbonUI
Sub Onload(ribbon As IRibbonUI)
Set myRibbon = ribbon
End Sub
Sub MyDDMacro(ByVal control As IRibbonControl, selectedId As String,
selectedIndex As Integer)
Select Case control.id
Case "DD1"
Select Case selectedIndex
Case Is = 1
'Report some data
MsgBox "Font name: " & Selection.Font.Name & ". Font size: " &
Selection.Font.Size
Case Is = 2
'Call a builtin Word command
Application.Run "ChangeCase"
Case Is = 3
'Call another procedure in this project
SampleModule.RandomizeCharactersInWordsFirstAndLastExclusive
End Select
'I invalidate the control so that "Select item" reappears after the
action is taken. You wouldn't do this if you want the selected item to
remain displayed.
myRibbon.InvalidateControl control.id
Case "DD2"
'Add another Select Case statement here similiar to the one shown above.
Case "DD3"
Case "DD4"
Case Else
'Do Nothing
End Select
End Sub
Sub GetSelectedItemIndex(ByVal control As IRibbonControl, ByRef Index)
Select Case control.id
Case "DD1"
Index = 0
Case "DD2"
Index = 0
Case "DD3"
Index = 0
Case "DD4"
Index = 0
Case Else
'Do nothing
End Select
End Sub
Sub GetLabel(ByVal control As IRibbonControl, ByRef label)
Select Case control.id
Case "DD1"
label = "Sample Dropdown List 1"
Case "DD2"
label = "Sample Dropdown List 2"
Case "DD3"
label = "Sample Dropdown List 3"
Case "DD4"
label = "Sample Dropdown List 4"
Case "CustomTab"
label = "Sample Tab"
Case "Grp1"
label = "Sample Group"
Case Else
'Do Nothing
End Select
End Sub
Sub GetItemLabel(ByVal control As IRibbonControl, Index As Integer, ByRef
label)
Select Case control.id
Case "DD1"
Select Case Index
Case Is = 0
label = "Select Item"
Case Is = 1
label = "Item 1"
Case Is = 2
label = "Item 2"
Case Is = 3
label = "Item 3"
End Select
Case "DD2"
Select Case Index
Case Is = 0
label = "Select Item"
Case Is = 1
label = "Item 1"
End Select
Case "DD3"
Select Case Index
Case Is = 0
label = "Select Item"
Case Is = 1
label = "Item 1"
Case Is = 2
label = "Item 2"
End Select
Case "DD4"
Select Case Index
Case Is = 0
label = "Select Item"
Case Is = 1
label = "Item 1"
Case Is = 2
label = "Item 2"
Case Is = 3
label = "Item 3"
Case Is = 4
label = "Item 4"
Case Is = 5
label = "Item 5"
End Select
Case Else
'"Do Nothing"
End Select
End Sub
Sub GetItemImage(ByVal control As IRibbonControl, Index As Integer, ByRef
image)
Select Case control.id
Case "DD1"
Select Case Index
Case Is = 0
image = "OutlineCollapse"
Case Is = 1
image = "FileStartWorkflow"
Case Is = 2
image = "FileStartWorkflow"
Case Is = 3
image = "FileStartWorkflow"
End Select
Case Else
'Do Nothing
End Select
End Sub
Sub GetItemID(ByVal control As IRibbonControl, Index As Integer, ByRef id)
Select Case control.id
Case "DD1"
Select Case Index
Case Is = 0
id = "DD1"
Case Is = 1
id = "DD2"
Case Is = 2
id = "DD3"
Case Is = 3
id = "DD4"
End Select
Case Else
'Do Nothing
End Select
End Sub
Sub GetItemCount(ByVal control As IRibbonControl, ByRef count)
Select Case control.id
Case "DD1"
count = 4
Case "DD2"
count = 2
Case "DD3"
count = 3
Case "DD4"
count = 5
Case Else
'Do Nothing
End Select
End Sub
Sub GetImage(ByVal control As IRibbonControl, ByRef image)
Select Case control.id
Case "DD1"
image = "ContentControlDropDownList"
Case Else
'Do Nothing
End Select
End Sub
Sub GetItemScreenTip(ByVal control As IRibbonControl, Index As Integer,
ByRef screentip)
Select Case control.id
Case "DD1"
Select Case Index
Case Is = 0
screentip = "This is the default displayed item."
Case Is = 1
screentip = "Select this second item to do ..."
Case Is = 2
screentip = "Select this thrid item to do ..."
Case Is = 3
screentip = "Select this fourth item to do ..."
End Select
Case Else
'Do Nothing
End Select
End Sub
Sub GetItemSuperTip(ByVal control As IRibbonControl, Index As Integer, ByRef
supertip)
Select Case control.id
Case "DD1"
Select Case Index
Case Is = 0
supertip = "This is the Supertip text: Blah, blah, blah."
Case Is = 1
supertip = "This is the Supertip text: Blah, blah, blah."
Case Is = 2
supertip = "This is the Supertip text: Blah, blah, blah."
Case Is = 3
supertip = "This is the Supertip text: Blah, blah, blah."
End Select
Case Else
'Do Nothing
End Select
End Sub
Hope this gets you on course.

Signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Help please - throwing myself in at deep end and dog paddling to create a
> working Custom Tab with multiple dropdowns plus buttons!
[quoted text clipped - 126 lines]
> Macros.Doc_Clean
> End Sub
Summer - 01 Mar 2008 21:44 GMT
Thank you Greg for being so generous with your time and assisting. I'll see
how I go (splashing all the way) and let you know.
> Summer,
>
[quoted text clipped - 401 lines]
>> Macros.Doc_Clean
>> End Sub
Summer - 02 Mar 2008 03:03 GMT
Greg,
I've load/unloaded the sample tab numerous times and it now seems to a be a
little more stable (very unstable this ribbon stuff). Anyway I've drag a
copy of 3 dds down to the QAT and moved the Addin to Startup.
But I get errors - Runtime error 91
object variable or with block variable not set
After the case call runs - even though it runs properly. Is it something to
do with the load/unload to the ribbon QAT do you think?
Do you know why that might be? I realise I didn't mention dragging the dds
to the QAT but I'm seeing what works and what doesn't.
QAT Customisation
I tried saving QAT customisation with a template but the trouble with that
is if a user has a full QAT - your 2 or 3 items which you add to a template
a user calls are not visible. At the moment I can't see this as a very
useful option. Do you know if there is an instruction as in the True/False
to hide Ribbon for QAT - so only the template QAT shows and not the user's
QAT?
Any assistance much appreciated.
> Summer,
>
[quoted text clipped - 401 lines]
>> Macros.Doc_Clean
>> End Sub
Greg Maxey - 02 Mar 2008 04:47 GMT
Summer,
I don't know what to tell you. Like you, I am just stumbling along trying
to learn a bit here and there. Last night I spent hours trying to get a
toggle button to behave properly ;-)
Other that customizing the QAT with the User Interface I haven't messed with
it much. I do know that to customize the QAT with RibbonX you have to use
the StartfromScratch method.
Have you read the Microsoft Articles on Ribbon Customization. There are
links to then on my Customize the Ribbon tips page on my website. You might
find something there.

Signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Greg,
>
[quoted text clipped - 431 lines]
>>> Macros.Doc_Clean
>>> End Sub
Summer - 02 Mar 2008 08:08 GMT
Yes "hours". I've figure I'd better start applying some of this stuff
because I assume I'm going to have to learn VETO .Net (whatever that equates
to!).
Not to worry - I've put it in startup and I'll build/hack a little each day
and see how I go.
Thanks for the BIG assist Greg much appreciated.
> Summer,
>
[quoted text clipped - 446 lines]
>>>> Macros.Doc_Clean
>>>> End Sub