Common Dialogs, selecting multiple files and displaying in list box
I have got my common dialog box created, and I can select on file at a time and add it to my listbox, but my question is
How do I go about taking multiple selected files in my common dialog and parsing them individually one by one in my list box
any help or direction will be appreciated
Re: Common Dialogs, selecting multiple files and displaying in list box
I suggest you use FileListBox and the DirListBox or for easier mainpulation you can use FSO then populate it in a listview by then you can multiselect the files you want. I suugest you use a listview by the way.
Re: Common Dialogs, selecting multiple files and displaying in list box
To allow a user to select multiple files include the cdlOFNAllowMultiselect constant in the Flags property. The FileName property will contain a list of all files selected. Use the Split function to convert that list into an array.
Code:
Dim aFiles() As String
With CommonDialog1
.FileName = ""
.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
.ShowOpen
aFiles() = Split(.FileName, vbNullChar)
End With
If the number of array elements is greater than 0, the first element is a directory name while all other elements are filenames. If the number of array elements is 0, ie one file was selected, the first (and only) element is the entire path to that file.