Commandbar combobox

R

Rick K

I have coded in vba a custom commandar with 5 buttons (for sheet navigation)
and 1 combobox (for running print routines). Everythinmg loads and runs OK
but what I can't seem to get a handle on is being able to pick the listindex
number from the combobox in order select a routine to run. The .onAction
function for the cbo is run in a sub routine (everything is run in a module)
any ideas.

Part of the code below--
Sub CreateRecapBar()
Dim TBar As CommandBar
Call DeleteRecapBar

Set TBar = CommandBars.Add(Name:=sCmbName, Position:=1, Temporary:=True)

'---toolbar
With TBar
.Position = msoBarBottom 'place bar as bottom toolbar
.Visible = True
'disable X button
.Protection = msoBarNoChangeVisible
.Protection = msoBarNoCustomize
'btn recap
.Controls.Add Type:=msoControlButton
With .Controls(1)
.Style = msoButtonCaption
.Caption = "Recap"
.OnAction = "Recap"
.BeginGroup = False
.TooltipText = "Recap"
End With
'-------combobox after 10 controls
.Controls.Add Type:=msoControlComboBox
With .Controls(11)
.Caption = "Print"
.AddItem ""
.AddItem "Prn Recap"
.AddItem "Prn Prep"
.AddItem "Prn Text"
.AddItem "Prn Cover"
.AddItem "Prn Other1"
.AddItem "Prn Other2"
.AddItem "Prn Non Case Bnd"
.AddItem "Prn Adh Case Bnd"
.AddItem "Prn Smyth Case Bnd"
.AddItem "Prn Packing"
.DropDownWidth = -1
.OnAction = "ProcessSelection"


End With
End With
 
L

lieven

have you tried to feed the processselection sub a parameter, that being the
combo's listindex

"Rick K" schreef:
 

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