CommandbarComboBox change event not triggering

P

Pavan

Hi
I'm creating a Toolbar in Visio with CommandbarCombo box.The combobox
should display the tooltip on change of each item. I have handled changeevent
but still event is not fired.

Any inputs on this is highly apprecaited.

Thanks in advance
Pavan
 
J

JuneTheSecond

change of each item
What do you change, ComboBox or Shape ? If ComboBox I have an example.
Public Sub AddComboBox()
Dim cbars As Office.CommandBars
Dim cbar As Office.CommandBar
Dim cbButton As Office.CommandBarButton
Dim cbCombo As Office.CommandBarComboBox

On Error GoTo ERRHAND
Set cbars = Application.CommandBars
Set cbar = cbars.Add(Name:="MyDrawingCommandBar", Position:=msoBarTop,
Temporary:=True)
cbar.Protection = msoBarNoCustomize
'* = visible in given context.
cbar.Context = Str(visUIObjSetDrawing) & "*"
Set cbCombo = cbar.Controls.Add(Type:=msoControlComboBox)
With cbCombo
.Caption = "Combo Box"
.AddItem "Good Morning"
.AddItem "Good Day"
.AddItem "Good Night"
.TooltipText = "Click this button to run a VBA Macro"
.Tag = "cbbVBAMacro"
.OnAction = "Macro_Combo"
End With
Set cbCombo = Nothing
ERRHAND:
End Sub

Public Sub DeleteCommandBar()
Dim cbar As Office.CommandBar
Dim cbCombo As CommandBarComboBox
On Error Resume Next
Set cbar = Application.CommandBars("MyDrawingCommandBar")
cbar.Delete
End Sub

Public Sub Macro_Combo()
Dim cbCombo As CommandBarComboBox
Set cbCombo =
Application.CommandBars("MyDrawingCommandBar").Controls("Combo Box")
Select Case cbCombo.ListIndex
Case 1: GoodMorning: cbCombo.TooltipText = "Say Good Morning"
Case 2: GoodDay: cbCombo.TooltipText = "Say Good Day"
Case 3: GoodNight: cbCombo.TooltipText = "Say Good Night"
End Select
End Sub

Public Sub GoodMorning()
MsgBox "Good Morning, EveryBody!"
End Sub

Public Sub GoodDay()
MsgBox "Good Day, John!"
End Sub

Public Sub GoodNight()
MsgBox "Good Night, Baby!"
End Sub
 
P

Pavan

Thanks a lot JuneTheSecond.
It is working fine with vba code. I tried to create add-ins with the c#
code. I face the same problem. Event is not getting binded.Can you suggest
any work around for this problem.

Thanks in advance

Pavan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top