I have the following code to copy several (more than 1) lines of a listbox with it's MultiSelect property set to 2-Enhanced.
It works, however, it is time consuming when I am using a fairly long list of items (my list1 has 1292 lines--varies within program, but I tested with the 1292 lines).
Is there a faster way to get selected lines (multiple) in a long listbox into memory other than this?
It works, however, it is time consuming when I am using a fairly long list of items (my list1 has 1292 lines--varies within program, but I tested with the 1292 lines).
Is there a faster way to get selected lines (multiple) in a long listbox into memory other than this?
Code:
Dim intCounter As Integer, myString As String
For intCounter = 0 to List1.ListCount - 1 'EDIT: found working backward through list reversed order of lines captured..DUH!
List1.ListIndex = intCounter
If List1.Selected(intCounter) = True Then
myString = myString & List1.Text & vbCr
End If
Next X
Clipboard.Clear
Clipboard.SetText (myString)