We help IT Professionals succeed at work.

Simple Combo Box question

Grunge
Grunge asked
on
How do i address an item in the list without clicking on it?

Eg of a combo box:

 TEXT
item1
item2
item3
item4


how do i get for example item2's value into a variable?

Thanks
Comment
Watch Question

Head of Software Services
CERTIFIED EXPERT
Commented:
To get an item in a combo box or list use:

value = Combo1.List(n)
or
value = List1.List(n)

Where n is the number of the item in the list (-1) as the list starts at 0 not 1 so for the second item in a combo box use:

value = Combo1.List(1)

CERTIFIED EXPERT

Commented:
Dim strValue As String

strValue = Combo1.List(1) ' get second element. index starts from 0
MsgBox strValue

hongjun

Author

Commented:
thanks both

Explore More ContentExplore courses, solutions, and other research materials related to this topic.