Open Folder dialog box

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
 
R

Ron de Bruin

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
 
B

Brad

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
 

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