Big_Belly_Bob
New Member
- Joined
- Feb 9, 2006
- Messages
- 27
Hey all,
I'm trying to make a Command bar (toolbar) for excell with a combo box in it (dropdown). I have my toolbar, and my combo box with options, and the Subs that I want it to run however I'm not sure how to tell excel which Sub to use when each option is selected?
I'm using this Code for adding the Combo box
My idea was to use Onaction to go to another sub (called Selector_Sub) which would then say If TstCombo = "Option One" then .... or something along those lines, although something in the code to create the Combo box that decides which Sub to use would be easier
Hope someone can help, my knowlage of VB is quite rudimentary as I've just picked it up as I go along.
I'm trying to make a Command bar (toolbar) for excell with a combo box in it (dropdown). I have my toolbar, and my combo box with options, and the Subs that I want it to run however I'm not sure how to tell excel which Sub to use when each option is selected?
I'm using this Code for adding the Combo box
Code:
Set TstCombo = myBar.Controls.Add(Type:=msoControlComboBox)
With TstCombo
.BeginGroup = True
.AddItem "Option One"
.AddItem "Option Two"
.Style = msoComboNormal
.Width = 100
.OnAction = "Selector_Sub"
End With
My idea was to use Onaction to go to another sub (called Selector_Sub) which would then say If TstCombo = "Option One" then .... or something along those lines, although something in the code to create the Combo box that decides which Sub to use would be easier
Hope someone can help, my knowlage of VB is quite rudimentary as I've just picked it up as I go along.