PDA

View Full Version : combobox



saban
01-29-2007, 01:52 AM
I would like the name in ComboBox to be shown as "Saban Saulic, M, DE"

But when I press ok button only "Saban Saulic" should be inserted into document, without "M, DE"(I am filling ComboBox with an array)

Any ideas how to do that
Thnx

lucas
01-29-2007, 09:01 AM
I would think that after you were questioned about this on the previous thread that I wouldn't have to ask the obvious question again........activeX combo on the page or is it in a userform?

lucas
01-29-2007, 09:10 AM
If you have code for populating your combobox from an array.....why didn't you post it?

lucas
01-29-2007, 09:14 AM
Here you go. From one of Bob's posts and it works great.
Private Sub UserForm_Initialize()
Dim aryCountries, aryCodes
Dim i As Long
aryCountries = Array("England", "France", "Holland", "Germany") 'etc.
aryCodes = Array("GB", "FR", "NL", "DE") 'etc
With ComboBox1
For i = 0 To UBound(aryCountries)
.AddItem aryCountries(i)
.List(i, 1) = aryCodes(i)
Next i
End With
End Sub
'
Private Sub ComboBox1_Change()
With Me.ComboBox1
MsgBox .List(.ListIndex, 1)
End With
End Sub