Prompting for a Directory Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Excel 2003. I currently use "Application.GetOpenFilename" to prompt users to
browse to and select a file. It returns the full file name with path. Is
there a similar method by which I can prompt the user to select (browse to) a
folder (NOT a file) and have that folder's name and full path returned?
Thanks for any help.
 
Private Sub CommandButton1_Click()

Dim lngCount As Long

' Open the file dialog
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = True
.Show

' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
MsgBox .SelectedItems(lngCount)
Next lngCount

End With

End Sub
 
According to the help on AllowMultiselect, it is ignored for picking folders.

Has your experience been different?
 

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

Back
Top