Brilliant! Thank you, Paul! This is almost what I am looking for. I did test this under different scenarios and here are the results:
With an empty listbox...
1) I select one file, then click Open File and select the same file from the same source folder. Result: Duplicate Selection message appears - OK.
2) I select one file, then click Open File and select the same file from a different source folder (the code is supposed to allow this). Result: The code allows the file (there is no Dup. Mssg) but only one of the filenames appears in the listbox. The list counter changes from 1 to 2. The counter is correct but the filename should appear with the other.
3) I select two files at the same time from the same source folder. The two files appear in the listbox. List counter accurately shows 2. Then I select three files from another folder; two have the same names as the first two from another folder. Result: Four files appear in the listbox instead of five. List counter is 5, which is correct.
Also, listbox3 should be sorted, but it's a multi-column box and I have only sort code (non-array) for regular listboxes.
+++++++++++++++++++++++++++++++++
I changed the counter for Listbox3 from
'lblTargetCount.Caption = "(" & .SelectedItems.Count & ")"
to
CountTargetFiles = ListBox3.listcount
lblTargetCount.Caption = "(" & CountTargetFiles & ")"
|