FolderPicker

R

Roy Lasris

'msoFileDialogFolderPicker' dialog seems to be the method of choice for
"folder picking" but nothing (other than sub-folders) displays in the list. I
need to be able to select a particular folder to perform a particular task, but
in order to have confidence that the right folder is being selected, the
contents of the folder needs to show. Any way to get folderpicker to display
files?

Thanks,

Roy
 
S

Steve Yandl

Roy,

Try this.

Open the VBE and under Tools>References check to set a reference to
"Microsoft Shell Controls and Automation". Then build something like the
sub below.

Sub ReturnFolder()
Dim strPath As String
Dim SH As Shell32.Shell
Dim Fldr As Shell32.Folder
Set SH = New Shell32.Shell
Set Fldr = SH.BrowseForFolder(0, "Select Folder", &H4000)
If Not Fldr Is Nothing Then
FldrPath = Fldr.Items.Item.Path
End If
MsgBox FldrPath
End Sub

The "&H4000" is going to have the dialog show the files contained in
selected folders.

Steve Yandl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top