Calvin Smith http://www.CalvinSmithSoftware.com/codedisk/sneakpeek.htm '********************************************************** '************ Code provided by CodeDisk II **************** '********************************************************** 'We need the following UDT, API declarations, and constants first 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 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 Private Const BIF_RETURNONLYFSDIRS = &H1 Public Function BrowseFolder(strDialogTitle As String) As String On Error GoTo ErrorHandling_Err ' ------------------------------------------------------------------------ ' Purpose: Example of how to use the Browse folder dialog ' ' Accepts: strDialogTitle as the title for the browser folder dialog ' ' Returns: The selected folder/path ' ' Example usage: ' strRetVal$= BrowseFolder("What folder is the file in?") ' ------------------------------------------------------------------------ Dim lRetVal As Long Dim bi As BROWSEINFO Dim dwIList As Long Dim strPath As String Dim iPos As Integer With bi .hOwner = hWndAccessApp .lpszTitle = strDialogTitle .ulFlags = BIF_RETURNONLYFSDIRS End With dwIList = SHBrowseForFolder(bi) strPath = Space$(512) lRetVal = SHGetPathFromIDList(ByVal dwIList, ByVal strPath) If lRetVal Then iPos = InStr(strPath, Chr(0)) BrowseFolder = Left$(strPath, iPos - 1) Else BrowseFolder = "" End If ErrorHandling_Err: If Err Then 'Trap your error(s) here, if any! End If End Function