im sorry for all the confusion. The rowsource and rowsourcetype are both blank because im filling the combobox with code. here is some code to describe the process...combobox1 is the combobox that gets filled with all the files in the folder, without the path, or the extension, and listbox1 is the box that should be filled with nothing but a list of duplicates, but not have any redundant data. Example) lets say that i have 3 files called "dave101" in the folder, but with different extensions. this code below will fill the combobox with all the names of the files in the folder. What i need to do is take that list, and use it to make a new list in the listbox where, for example, in this case there will be one entry in the listbox that says "dave101" :
public sub fillboxes()
count2 = 0
strcount = 0
With Application.FileSearch
.NewSearch
.LookIn = "C:\myfolder\"
.SearchSubFolders = True
.Filename = "*.D*"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
End With
With Application.FileSearch
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.count & _
" file(s) found."
For i = 1 To .FoundFiles.count
'this part just is a string parsing operation, but not needed
part1 = Left(.FoundFiles(i), InStrRev(.FoundFiles(i), ".") - 1)
strcount = InStrRev(part1, "\")
part2 = Mid(part1, strcount + 1)
'this is where the items get added to the combobox
ComboBox1.AddItem part2
Next i
Else
'an error case if no files are in folder
MsgBox "There were no files found."
End If
For u = 0 To .FoundFiles.count - 1
'setfocus to the "u" position in the combobox, save it to variable
ComboBox1.ListIndex = u
part3 = ComboBox1.Text
'nested loop that looks for duplicates
For g = 0 To .FoundFiles.count - 1
ComboBox1.ListIndex = g
If part3 = ComboBox1.Text Then
count2 = count2 + 1
'if there was more than one (a duplicate entry)
If count2 > 1 Then
'add it to the list of duplicates
ListBox1.AddItem part3
count = 0
g = .FoundFiles.count - 1
End If
End If
Next g
Next u
End With
End Sub
this code almost works, but the only thing is i cant figure out how to stop the second listbox from having any duplicate entries...any help guys?