ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can you place a combo box in a custom toolbar? (https://www.excelbanter.com/excel-programming/282118-can-you-place-combo-box-custom-toolbar.html)

coosk

Can you place a combo box in a custom toolbar?
 

Is is possible to place combo boxes in a toolbar? How is it done?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Chip Pearson

Can you place a combo box in a custom toolbar?
 
Try something like the following:

Sub Init()
Dim Cbx As Office.CommandBarComboBox
Set Cbx = Application.CommandBars("Standard").Controls.Add( _
Type:=msoControlComboBox)
With Cbx
.Caption = "Choose"
.Tag = "Combobox1"
.AddItem "Item 1"
.AddItem "Item 2"
.AddItem "Item 3"
.OnAction = ThisWorkbook.Name & "!CbxClick"
End With
End Sub

Sub CbxClick()
Dim Cbx As Office.CommandBarComboBox
Set Cbx = Application.CommandBars.ActionControl
MsgBox "You choose: " & Cbx.List(Cbx.ListIndex)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"coosk" wrote in message
...

Is is possible to place combo boxes in a toolbar? How is it done?


------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com