Inspector wrap...still having problems

  • Thread starter Thread starter Stephane Gendron
  • Start date Start date
S

Stephane Gendron

Hi,

I recently add an inspector wrap to my Com add-in to correct a problem.

My problem was that my toolbar was only working on the latest inspector.

This problem is almost fix. Now my buttons works but my listbox doesn't
works...

I have 2 listbox and when you choose an item in the first listbox the sub
change of my listbox is not fire up. I fill the second listbox In the change
sub of the first listbox.

There is no event on the second listbox.

Anyboby have an idea??

Steph
 
Be more specific. Where are those listboxes? Are they on Outlook forms or a
VB form or what? Did you change any binding on those controls if they are on
Outlook forms?
 
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
 
Err.Number is not a string. It's a numeric value. You should first of all
try to find an existing button, control or toolbar by assigning it to an
appropriate object and then delete it if it exists. Second, always use
..OnAction if you want to handle any events for whatever you added. Third,
always use a unique .Tag property for each object you add or you will
receive multiple event firings each time the object is clicked.

Combo's in Outlook CommandBars are problematical. Some people have gotten
them to work but most people have found they don't work correctly in Outlook
even if they do in other Office applications.
 
Back
Top