English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

You need to set the flags property. You can use a single flag or combine several different flags by using an OR between each flag.

CommonDialog1.Flags = cdlOFNExplorer OR cdlOFNAllowMultiselect (all on one line)

CommonDialog1.Flags = &H80000 OR &H200

VB provides constants for the flag values. You can also use the HEX values instaead or wriye your own constant variables using shorter names

***** WARNING *******

Multi files are returned as a single string starting with the path and all files concatenated together with a delimiter character between each.
Depending on the flags you set the seperator can be either a space or a null. The delimiter used depends on wether or not you are able to view long file names. If short file names are used a Space is the delimiter. If Long file names are used (as in my example) a null is used to delimit the files.

This code uses the split function to extract the path and files.
I have also defined my own null seperator rather than use VbNull as the seperator in the split function. I sometimes have problems using VbNull.

Dim strFiles() As String 'array to hold the split files
Dim intCnt As Integer ' count of array elements
Dim Cnt As Integer ' used to index through the array
Dim sep as string 'delimiter character

sep = Chr(0) 'define a null seperator

With Me.CommonDialog1

.Flags = &H80000 Or &H200 'use long filenames
.ShowOpen
Debug.Print (.FileName)
strFiles = Split(.FileName, sep)
intCnt = UBound(strFiles)

For Cnt = 0 To intCnt
Debug.Print (strFiles(Cnt))
Next Cnt

End With

2007-12-03 12:50:39 · answer #1 · answered by MarkG 7 · 0 0

Try setting the Flags property to cdlOFNAllowMultiselect -- or better yet, OR that flag to its existing flags:

CommonDlg1.Flags = CommonDlg1.Flags Or cdlOFNAllowMultiselect

(Where CommonDlg1 is a Common Dialog Control object.)


Good Luck!

2007-12-03 17:14:29 · answer #2 · answered by Random Malefactor 5 · 1 0

There's a property for that control called Multi-Select. Set that to true

2007-12-03 17:14:59 · answer #3 · answered by Anonymous · 0 1

fedest.com, questions and answers