Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stringing ListBox Selections

Status
Not open for further replies.

Cohen227

MIS
Oct 30, 2001
8
US
I am trying to put the items selcted in a multiselect ListBox into a String. I am using the following code but it is not working properly. It will not display each selection, only one selection multiple times. Here is my code:
Dim varItem As Variant
Dim txtTemp As String
For Each varItem In Me.Hospital_Characteristics.ItemsSelected
txtTemp = txtTemp & Me.Hospital_Characteristics.Column(0) & " "
Next
Me.HCString = txtTemp

Any Ideas???Thanks!
 
Hi,

This is the code I am currently using in Excel:

iRow = lstInvoices.ListCount - 1

'iElement = 0

' First count the number of rows selected
For i = 0 To iRow
If lstInvoices.Selected(i) Then
' populate array with filename
' iElement = iElement + 1
txtTemp = txtTemp & lstInvoices.List(i)
End If
Next i

Hope this is ok. If not, just let me know.

Nick (Everton Rool OK!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top