list box with multi-select

M

mike

Hi all,

I'm having trouble with the multi-select. I got a
solution to get the items that are selcted from the list
box. But, I'm stuck in extracting the items and put the
items to another array.

My list box have the values in it and all of them is
selected.

User list box:

Last Name | First Name
Doe John
Doe John Jr.


Here is my code to get the selected items

Dim Ctl As Control
Dim varItm As Variant, intI As Integer, i As Integer,
ccount As Integer
Dim str As String, uname(20) As String, uholder(20) as
string

i = 0
ccount = 0
Set Ctl = Me.UserResult
For Each varItm In Ctl.ItemsSelected
For intI = 0 To Ctl.ColumnCount - 1
str = str & " " & Ctl.Column(intI, varItm)
Next intI
uname(i) = str
str = ""
i = i + 1
ccount = ccount + 1
Next varItm

The uname(0) array holds the string value of (Doe John)
and so on. Now, I'm geting stuck on extracting the uname
array and assign it to another array by using the
following code:

For j = 0 To ccount - 1
uholder(j)=Split(uname(j)," ")
** The above line should split the uname array and
assigned the value to uholder array. The result of the
uholder array should be uholder(0)=Doe and uholder(1)
=John. But the code doesn't work. Please help........

Thanks for the help

mike.
 

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