Hi,<br>
<br>
I have the following code snippet to which you are welcome. Provided with usual caveats 'use at peril' etc :>.<br>
<br>
Put this in a module:<br>
<br>
Option Explicit<br>
<br>
Private Type BrowseInfo<br>
hWndOwner As Long<br>
pIDLRoot As Long<br>
pszDisplayName As Long<br>
lpszTitle As Long<br>
ulFlags As Long<br>
lpfnCallback As Long<br>
lParam As Long<br>
iImage As Long<br>
End Type<br>
<br>
'Browsing for directory.<br>
Private Const BIF_RETURNONLYFSDIRS = &H1 'For finding a folder to start document searching<br>
Private Const BIF_DONTGOBELOWDOMAIN = &H2 'For starting the Find Computer<br>
Private Const BIF_STATUSTEXT = &H4<br>
Private Const BIF_RETURNFSANCESTORS = &H8<br>
<br>
Private Const BIF_BROWSEFORCOMPUTER = &H1000 'Browsing for Computers.<br>
Private Const BIF_BROWSEFORPRINTER = &H2000 'Browsing for Printers<br>
Private Const BIF_BROWSEINCLUDEFILES = &H4000 'Browsing for Everything<br>
<br>
Private Const MAX_PATH = 260<br>
<br>
Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)<br>
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal _<br>
lpString1 As String, ByVal lpString2 As String) As Long<br>
<br>
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As _<br>
BrowseInfo) As Long<br>
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As _<br>
Long, ByVal lpBuffer As String) As Long<br>
<br>
Public Function BrowseForFolder(hWndOwner As Long, sPrompt As String) As String<br>
<br>
'=================================================<br>
'Opens the system dialog for browsing for a folder<br>
'=================================================<br>
Dim iNull As Integer<br>
Dim lpIDList As Long<br>
Dim lResult As Long<br>
Dim sPath As String<br>
Dim udtBI As BrowseInfo<br>
<br>
With udtBI<br>
.hWndOwner = hWndOwner<br>
.lpszTitle = lstrcat(sPrompt, ""

<br>
<br>
.ulFlags = BIF_RETURNONLYFSDIRS<br>
End With<br>
<br>
lpIDList = SHBrowseForFolder(udtBI)<br>
If lpIDList Then<br>
sPath = String$(MAX_PATH, 0)<br>
lResult = SHGetPathFromIDList(lpIDList, sPath)<br>
Call CoTaskMemFree(lpIDList)<br>
iNull = InStr(sPath, vbNullChar)<br>
If iNull Then<br>
sPath = Left$(sPath, iNull - 1)<br>
End If<br>
End If<br>
<br>
BrowseForFolder = sPath<br>
<br>
End Function<br>
<br>
<br>
<br>
<br>
Put this in a form:<br>
<br>
Private Sub Form_Click()<br>
Dim MyStr As String<br>
MyStr = BrowseForFolder(hWnd, "Hello"

<br>
MsgBox MyStr<br>
End Sub<br>
<br>
<br>
<br>
Click on the form, and see if it's what you want.....<br>
<br>
HTH<br>
<br>
Andrew<br>