Try this:
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_FINDSTRINGEXACT = &H1A2
Private Sub Command1_Click()
Dim iIndex As Long
Dim iCur As Long
For iCur = 1 To List1.ListCount
While iIndex > -1 And iIndex <> iCur
iIndex = SendMessage(List1.hwnd, LB_FINDSTRINGEXACT, iCur, ByVal List1.List(iCur))
If iIndex <> iCur And iIndex > -1 Then
List1.RemoveItem iIndex
End If
Wend
Next
End Sub
N.B. It would work even better and faster if you checked for repeat occurances before adding an Item to the List, then you'd only need to look for 1 Repeat Occurance.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]