Open Folder dialog box

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Thanks for taking the time to read my question.

I would like to run some code that asks the user to selet the folder to look
in, and the standard dialog box opens that shows the file system on the PC.
I've done this before but can't find me code!!!

Any help would be great,

Thanks,

Brad
 
Hi Brad

Try this for a folder
If you want to select files then post back

Sub test()
Dim oApp As Object
Dim oFolder As Variant

Set oApp = CreateObject("Shell.Application")

'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)
If Not oFolder Is Nothing Then
MsgBox "You select this folder : " & oFolder.Self.Path
End If

End Sub
 
Perfect,

Thanks so much.

Brad

Ron de Bruin said:
Hi Brad

Try this for a folder
If you want to select files then post back

Sub test()
Dim oApp As Object
Dim oFolder As Variant

Set oApp = CreateObject("Shell.Application")

'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)
If Not oFolder Is Nothing Then
MsgBox "You select this folder : " & oFolder.Self.Path
End If

End Sub
 
Back
Top