


ulFlags = BIF_RETURNONLYFSDIRS ' + BIF_USENEWUI. pszDisplayName = String $ ( MAX_PATH, vbNullChar ).

It returns ' the complete path name of the selected folder or vbNullString if the ' user cancelled. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Const BIF_RETURNONLYFSDIRS As Long = & H1 Private Const BIF_DONTGOBELOWDOMAIN As Long = & H2 Private Const BIF_RETURNFSANCESTORS As Long = & H8 Private Const BIF_BROWSEFORCOMPUTER As Long = & H1000 Private Const BIF_BROWSEFORPRINTER As Long = & H2000 Private Const BIF_BROWSEINCLUDEFILES As Long = & H4000 Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszINSTRUCTIONS As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Private Declare Function SHGetPathFromIDListA Lib "shell32.dll" ( ByVal pidl As Long, _īyVal pszBuffer As String ) As Long Private Declare Function SHBrowseForFolderA Lib "shell32.dll" ( lpBrowseInfo As _īROWSEINFO ) As Long Private Const MAX_PATH = 260 ' Windows mandated Sub TestBrowseFilesAndFolders () Dim sRet As String 'run to test the file selection dialog sRet = SelectFile ( "Select a file." ) 'run to test the folder selection dialog 'sRet = SelectFolder("Select a folder.") 'run to test the API folder selection dialog 'sRet = BrowseFolder("Select a folder.") MsgBox sRet End Sub Function BrowseFolder ( Optional ByVal DialogTitle As String = "" ) As String ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' BrowseFolder ' This displays the standard Windows Browse Folder dialog. It returns the complete path of the selected folder or vbNullString if the user cancelled.
