ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   msoControlComboBox Value (https://www.excelbanter.com/excel-programming/395213-msocontrolcombobox-value.html)

JayWes

msoControlComboBox Value
 
I've created a new toolbar combobox but I can't figure out how to retrieve
the value that's been selected... Help

Here's the code...
------------------------------------------------------------------------------------------------
Sub JumpToAdd()

Set MyBar = CommandBars.Add(Name:="Jump To:", Position:=msoBarTop,
Temporary:=True)
MyBar.Visible = True
Set newCombo = MyBar.Controls.Add(Type:=msoControlComboBox)
With newCombo
.Width = 100
.AddItem "Home"
.AddItem "Properties"
.AddItem "PropertiesMPa"
.AddItem "Chrysler Stats L"
.AddItem "Chrysler Stats T"
.AddItem "Chrysler Stats D"
.AddItem "Ford Stats L"
.AddItem "Ford Stats T"
.AddItem "Ford Stats D"
.AddItem "GM Stats L"
.AddItem "GM Stats T"
.AddItem "GM Stats D"
.AddItem "GMC D Stats L"
.AddItem "GMC D Stats T"
.AddItem "GMC D Stats D"
.AddItem "Honda Stats L"
.AddItem "Honda Stats T"
.AddItem "Honda Stats D"
.AddItem "Nissan Stats L"
.AddItem "Nissan Stats T"
.AddItem "Nissan Stats D"
.AddItem "Toyota Stats L"
.AddItem "Toyota Stats T"
.AddItem "Toyota Stats D"
.Style = msoComboNormal
.OnAction = "JumpTo"
End With
End Su
------------------------------------------------------------------------------------------------
Sub JumpTo()

**** Retrieve Combobox Value and Execute Script ****

End Sub



Jim Rech

msoControlComboBox Value
 
Sub JumpTo()
With CommandBars.ActionControl
MsgBox .List(.ListIndex)
End With
End Sub


--
Jim
"JayWes" wrote in message
...
I've created a new toolbar combobox but I can't figure out how to retrieve
the value that's been selected... Help

Here's the code...
------------------------------------------------------------------------------------------------
Sub JumpToAdd()

Set MyBar = CommandBars.Add(Name:="Jump To:", Position:=msoBarTop,
Temporary:=True)
MyBar.Visible = True
Set newCombo = MyBar.Controls.Add(Type:=msoControlComboBox)
With newCombo
.Width = 100
.AddItem "Home"
.AddItem "Properties"
.AddItem "PropertiesMPa"
.AddItem "Chrysler Stats L"
.AddItem "Chrysler Stats T"
.AddItem "Chrysler Stats D"
.AddItem "Ford Stats L"
.AddItem "Ford Stats T"
.AddItem "Ford Stats D"
.AddItem "GM Stats L"
.AddItem "GM Stats T"
.AddItem "GM Stats D"
.AddItem "GMC D Stats L"
.AddItem "GMC D Stats T"
.AddItem "GMC D Stats D"
.AddItem "Honda Stats L"
.AddItem "Honda Stats T"
.AddItem "Honda Stats D"
.AddItem "Nissan Stats L"
.AddItem "Nissan Stats T"
.AddItem "Nissan Stats D"
.AddItem "Toyota Stats L"
.AddItem "Toyota Stats T"
.AddItem "Toyota Stats D"
.Style = msoComboNormal
.OnAction = "JumpTo"
End With
End Sub
------------------------------------------------------------------------------------------------
Sub JumpTo()

**** Retrieve Combobox Value and Execute Script ****

End Sub





Bob Phillips

msoControlComboBox Value
 
Sub JumpTo()
With Application.CommandBars.ActionControl
MsgBox .Text
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"JayWes" wrote in message
...
I've created a new toolbar combobox but I can't figure out how to retrieve
the value that's been selected... Help

Here's the code...
------------------------------------------------------------------------------------------------
Sub JumpToAdd()

Set MyBar = CommandBars.Add(Name:="Jump To:", Position:=msoBarTop,
Temporary:=True)
MyBar.Visible = True
Set newCombo = MyBar.Controls.Add(Type:=msoControlComboBox)
With newCombo
.Width = 100
.AddItem "Home"
.AddItem "Properties"
.AddItem "PropertiesMPa"
.AddItem "Chrysler Stats L"
.AddItem "Chrysler Stats T"
.AddItem "Chrysler Stats D"
.AddItem "Ford Stats L"
.AddItem "Ford Stats T"
.AddItem "Ford Stats D"
.AddItem "GM Stats L"
.AddItem "GM Stats T"
.AddItem "GM Stats D"
.AddItem "GMC D Stats L"
.AddItem "GMC D Stats T"
.AddItem "GMC D Stats D"
.AddItem "Honda Stats L"
.AddItem "Honda Stats T"
.AddItem "Honda Stats D"
.AddItem "Nissan Stats L"
.AddItem "Nissan Stats T"
.AddItem "Nissan Stats D"
.AddItem "Toyota Stats L"
.AddItem "Toyota Stats T"
.AddItem "Toyota Stats D"
.Style = msoComboNormal
.OnAction = "JumpTo"
End With
End Sub
------------------------------------------------------------------------------------------------
Sub JumpTo()

**** Retrieve Combobox Value and Execute Script ****

End Sub





JayWes

msoControlComboBox Value
 
Thank You Bob and Jim!!! That's all I needed.

"Jim Rech" wrote:

Sub JumpTo()
Msgbox CommandBars.ActionControl.Text
End Sub

--
Jim
"JayWes" wrote in message
...
| I've created a new toolbar combobox but I can't figure out how to retrieve
| the value that's been selected... Help
|
| Here's the code...
| ------------------------------------------------------------------------------------------------
| Sub JumpToAdd()
|
| Set MyBar = CommandBars.Add(Name:="Jump To:", Position:=msoBarTop,
| Temporary:=True)
| MyBar.Visible = True
| Set newCombo = MyBar.Controls.Add(Type:=msoControlComboBox)
| With newCombo
| .Width = 100
| .AddItem "Home"
| .AddItem "Properties"
| .AddItem "PropertiesMPa"
| .AddItem "Chrysler Stats L"
| .AddItem "Chrysler Stats T"
| .AddItem "Chrysler Stats D"
| .AddItem "Ford Stats L"
| .AddItem "Ford Stats T"
| .AddItem "Ford Stats D"
| .AddItem "GM Stats L"
| .AddItem "GM Stats T"
| .AddItem "GM Stats D"
| .AddItem "GMC D Stats L"
| .AddItem "GMC D Stats T"
| .AddItem "GMC D Stats D"
| .AddItem "Honda Stats L"
| .AddItem "Honda Stats T"
| .AddItem "Honda Stats D"
| .AddItem "Nissan Stats L"
| .AddItem "Nissan Stats T"
| .AddItem "Nissan Stats D"
| .AddItem "Toyota Stats L"
| .AddItem "Toyota Stats T"
| .AddItem "Toyota Stats D"
| .Style = msoComboNormal
| .OnAction = "JumpTo"
| End With
| End Sub
| ------------------------------------------------------------------------------------------------
| Sub JumpTo()
|
| **** Retrieve Combobox Value and Execute Script ****
|
| End Sub
|
|





All times are GMT +1. The time now is 07:09 AM.

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