PDA

View Full Version : MultiSelect File Dialog



lucas.conceicao237868
2011-02-21, 03:18 PM
Hello everybody,

I have a code that open multiselected files.




Set objFile = New FileDialogs
strFilter = "Files |*.dwg;*.dxf;*.tiff"
objFile.OwnerHwnd = ThisDrawing.HWND
objFile.Title = "Open a drawing"
objFile.MultiSelect = True
objFile.StartInDir = "c:\"
objFile.Filter = strFilter
strFileName = objFile.ShowOpen
If Not strFileName = vbNullString Then
MsgBox strFileName
End If
Set objFile = Nothing



When i select for example 2 files, MsgBox Show me a message like this --> D:\Lucas\Drwaings\drawing1.dwg drawing2.dwg

I want to know how can i get the fileNames.

After i get the file names i have to add them in 2 listBoxes.

ANybody have any iDEA?

Thanks.

arshiel88
2011-02-22, 08:01 PM
I did a little research on your problem. I don't know how you are using the file dialogs but I assume you are using Windows API declarations. Anyhow, the trick was the Split function.


vFiles = Split(Left(strFileName, InStr(strFileName, Chr(0) & Chr(0)) - 1), Chr(0))


vFiles will be an array containing all the selected files. vFiles(0) will be the path.
Then you can add vFiles(0)+ vFiles(1) etc. to your ListBox entries.

Notice that you will not have the "\" on the path unless the path is the root drive, so you have to add a backslash when needed.

I have attached the project file (project.dvb) for your reference.

lucas.conceicao237868
2011-02-25, 11:58 AM
Thanks for your answer arshiel.

I have solved my problem 3 days ago,

but i didnt post the code.

i forgot what i've done but it have worked good.

Thanks for your help. =D