in un modulo:
codice:
Option Explicit

Private Type BROWSEINFO
    hOwner As Long
    pidlRoot As Long
    pszDisplayName As String
    lpszTitle As String
    ulFlags As Long
    lpfn As Long
    lParam As Long
    iImage As Long
End Type

Private Const BIF_RETURNONLYFSDIRS As Long = &H1

Private Declare Function SHGetPathFromIDList Lib "Shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "Shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Public Function BrowseForFolder(ByVal hwnd As Long, ByVal szDialogTitle As String) As String
    Dim BI As BROWSEINFO
    Dim dwIList As Long, RetVal As Long
    Dim szPath As String
    BI.hOwner = hwnd
    BI.lpszTitle = szDialogTitle
    BI.ulFlags = BIF_RETURNONLYFSDIRS
    szPath = Space$(1024)
    dwIList = SHBrowseForFolder(BI)
    RetVal = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)
    If RetVal Then
        BrowseForFolder = Left$(szPath, InStr(szPath, Chr(0)) - 1)
    Else
        BrowseForFolder = ""
    End If

End Function
E in una Form con un pulsante chiamato Command1 e un campo testo Text1:

codice:
Private Sub Command1_Click()
    Dim Temp As String
    Temp = BrowseForFolder(Me.hwnd, "Selezionare una cartella:")
    If Temp <> "" Then Text1.Text = Temp
    If Text1 <> "" And Right(Text1, 1) <> "\" Then Text1 = Text1 + "\"
End Sub