Private Sub Command1_Click() Dim i As Long, j As Long Dim bDuplicate As Boolean
For i = 0 To File1.ListCount - 1 If File1.Selected(i) Then If List1.ListCount > 0 Then bDuplicate = False For j = 0 To List1.ListCount - 1 If List1.List(j) = File1.List(i) Then bDuplicate = True Exit For End If Next If Not bDuplicate Then List1.AddItem File1.List(i) Else List1.AddItem File1.List(i) End If End If Next End Sub
Dim i As Long, j As Long
Dim bDuplicate As Boolean
For i = 0 To File1.ListCount - 1
If File1.Selected(i) Then
If List1.ListCount > 0 Then
bDuplicate = False
For j = 0 To List1.ListCount - 1
If List1.List(j) = File1.List(i) Then
bDuplicate = True
Exit For
End If
Next
If Not bDuplicate Then List1.AddItem File1.List(i)
Else
List1.AddItem File1.List(i)
End If
End If
Next
End Sub