Need to use a dialog box showing a view of explorer in which I would be able to select a directory (without any file)

Hi,

Access-VBA
I need to get a full pathname of a directory by using a dialog box which would show a view of the explorer ... kind of SaveAs common dialog box but without having to select a file just the folder/directory and then stored the pathname into a parameter table. I saw the same question but for another topic area ..., thanks for help !

MadesoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nffvrxqgrcfqvvcCommented:
Dim objShell As Object
 Dim objFItem As Object
   Dim objFolder As Object
   Set objShell = CreateObject("Shell.Application")
   Set objFolder = objShell.BrowseForFolder(0, "BROWSE FOLDER", 0, "C:\")
   If objFolder Is Nothing Then
       GoTo ExitSub
   End If
   Set objFItem = objFolder.Items.Item
   MsgBox objFItem.Path
    Set objFolder = Nothing
ExitSub:
   Set objFItem = Nothing
   Set objFolder = Nothing
   Set objShell = Nothing
 End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ryan ChongSoftware Team LeadCommented:
MadesoAuthor Commented:
Great! Working perfectly!
Thanks for help and for a so quick answer !
nffvrxqgrcfqvvcCommented:
Madeso, I forgot to mention that to get a list of My Computer, and all other special folders just remove the specified path.
Lists mycomputer,mydocuments etc...
Set objFolder = objShell.BrowseForFolder(0, "BROWSE FOLDER", 0, vbNullString)

The below code will just list the C:\ drive
 Set objFolder = objShell.BrowseForFolder(0, "BROWSE FOLDER", 0, "C:\")
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.