Tuesday, December 21, 2010

Browse for folder – new folder button

You are normally using SHBrowseForFolder API function to let user browse for folder, sample code you can find at MVPs.org or Lebans.com. In order to show "Make new folder" button on this dialog you need to set following flag:

.ulFlags = .ulFlags Or &H40


SNAGHTMLc5f856



And MSDN BROWSEINFO Structure page lists other flags you can set for that dialog.

3 comments:

  1. You could also use the Shell.BrowseForFolder method, no API required. Ex:

    Dim ShellApp As Object
    Set ShellApp = CreateObject("Shell.Application"). _
    BrowseForFolder(0, "Please choose a folder", 0)

    You can still use the BROWSEINFO ulFlags structure.

    ReplyDelete
  2. Thanks for comment, JP!
    here more info on that method:
    Shell.BrowseForFolder Method

    ReplyDelete
  3. For even more flexibility, customization and functions, check out the FolderView control. It removes many of the limitations associated with using the "Browse for folder" dialog.

    See http://www.ssware.com/fldrview.htm

    ReplyDelete