I make a mistake...I write that I use listboxes....but I use comboboxes.
Here is more details
The combobox are place on a outlook forms.
Here is the code I use to create the toolbar on creation of a new inspector
Private Sub colInsp_NewInspector(ByVal Inspector As Outlook.Inspector)
On Error GoTo ERRH_colInsp_NewInspector
Dim objToolBar As CommandBar
Dim cbClient As CommandBarComboBox
Dim strSub As String
Dim sngStep As Single
'----------------------------
strSub = strModule & "colInsp_NewInspector"
AddInsp Inspector
Err.Clear
On Error Resume Next
Set objToolBar = Inspector.CommandBars.Item("PlombcoAssocieClient")
If Err.Number = "" Then
objToolBar.Delete
End If
Err.Clear
On Error GoTo ERRH_colInsp_NewInspector
Set objToolBar = Inspector.CommandBars.Add("PlombcoAssocieClient",
msoBarTop, , False)
'*********************************************************
' CREATION OF THE FIRST COMBOBOX
'*********************************************************
Set objCBCBClient = objToolBar.Controls.Add(Type:=msoControlComboBox)
objCBCBClient.Tag = "Client"
' Ajouter la liste de Client dans le ComboBox
RemplirComboBox objCBCBClient
objCBCBClient.Width = 300
objCBCBClient.OnAction = "<!" & gstrProgID & ">"
objCBCBClient.Caption = "Client"
'*********************************************************
' CREATION OF THE SECOND COMBOBOX
'*********************************************************
' Ajouter la liste de contact des clients
Set cbClient = objToolBar.Controls.Add(Type:=msoControlComboBox)
cbClient.Tag = "Contact"
cbClient.Width = 300
'cbClient.OnAction = "" '******** THERE IS NO ACTION FOR THIS COMBOBOX
cbClient.Caption = "Contact"
'*********************************************************
' CREATION OF THE FIRST BUTTON...THERE IS NO PROBLEM
'*********************************************************
' Ajouter le bouton Associer et Deplacer
Set objCBBAssocier = objToolBar.Controls.Add(Type:=msoControlButton)
objCBBAssocier.Tag = "Associer"
objCBBAssocier.Caption = "Associer et déplacer"
objCBBAssocier.OnAction = "<!" & gstrProgID & ">"
objCBBAssocier.ToolTipText = "Associer l'item à un contact"
'*********************************************************
' CREATION OF THE SECOND BUTTON...THERE IS NO PROBLEM
'*********************************************************
' Ajouter le bouton qui permet de remettre a zero les Combobox
Set objCBBInitialiser = objToolBar.Controls.Add(Type:=msoControlButton)
objCBBInitialiser.Tag = "Initialiser"
objCBBInitialiser.Caption = "Ré-initialiser"
objCBBInitialiser.OnAction = "<!" & gstrProgID & ">"
'btnAssocier.OnAction = strProjet & "InitialiserContact"
objCBBInitialiser.ToolTipText = "Initialiser les 2 listes"
' Initialiser les listes de choix
objCBCBClient.Text = ""
cbClient.Text = ""
objToolBar.Position = msoBarTop
objToolBar.Visible = True
'----------------------------
exit_colInsp_NewInspector:
Set cbClient = Nothing
Set objToolBar = Nothing
Exit Sub
ERRH_colInsp_NewInspector:
Call HandleError(Err.Number, Err.Description, 1, strSub, sngStep, False)
Resume exit_colInsp_NewInspector
End Sub