Revision History
Site Map

Graph: dbPix image storage vs OLE Embedding and Linking in Microsoft Access

The Access Image FAQ < Previous ArticleNext Article >

How to display the Common 'Browse for Folder' Dialog to Choose a Folder

Sample Newsgroup Questions 
Browse for Folder dialog box
Control to browse hard drive for folder name?
Browse folder button on Access form
"Browse for Folder" Dialog Box
How to browse the folder structure in Access
Finding a folder
Help with Dir/folder browse
Directory List Boxes - Available in VBA?
Export and photo path questions
Select folder dialog box

Sometimes it may be useful to allow the user to choose a folder, for example to batch-import all the images in that folder, or to specify a directory to export images. The 'Common Browse-For-Folder' dialog provides a flexible and consistent way to do this, using the standard dialog which most Windows users are already familiar with.

We can display the 'Browse For Folder' dialog using Windows API calls, and fortunately Terry Kreft has generously written a module that you can reuse in your applications, reducing the effort to a cut-and-paste, then writing just a few lines to show the dialog.


To use a 'Browse For Folder' dialog, download or open the following file containing Terry's code, then copy and paste the entire contents into a new module.   Download Code

The following code shows how to display a 'Browse For Folder' dialog in respose to a button-click. See the screenshot below for the results.

Private Sub btnBrowseForFolder_Click()

    Dim strFolderName As String

    strFolderName = BrowseFolder("Choose Folder For Import")

    If Len(strFolderName) > 0 Then
        ' Do something with the selected folder
        'No folder chosen, or user canceled
    End If

End Sub

In the code above you can modify the string 'Choose an image file...' to control the text displayed at the top of the dialog.

The dialog can be further customized by modifying the values of the BROWSEINFO structure in the module. See the API Documentation for a detailed description of the BROWSEINFO structure.

Stephen Lebans proposes a solution for specifying the initial folder when the dialog opens. See Stephen's 'CallBackBrowser' page here.

The 'Browse For Folder' Dialog

Related Articles

How to display the Common 'File-Open' Dialog to Choose a File

Imaging for Access that's Easy, Efficient & Fast
  • NO OLE Bloat
  • NO App Dependencies
  • NO Complex Coding
  • NO Performance Penalty
  •  DBPix logo
    Read More

    Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.