Darren DICK
d.dick at uws.edu.au
Tue Feb 8 21:44:49 CST 2005
Hi John Try """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Option Compare Database Option Explicit Private Type BROWSEINFO hwndOwner As Long pidlRoot As Long pszDisplayName As Long lpszTitle As Long ulFlags As Long lpfnCallback As Long lParam As Long iImage As Long End Type Private Const BIF_RETURNONLYFSDIRS = 1 Private Const MAX_PATH = 260 Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long) Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _ (ByVal lpString1 As String, ByVal lpString2 As String) As Long Private Declare Function SHBrowseForFolder Lib "Shell32" _ (lpbi As BROWSEINFO) As Long Private Declare Function SHGetPathFromIDList Lib "Shell32" _ (ByVal pidList As Long, ByVal lpBuffer As String) As Long Public Function BrowseForFolder(hwndOwner As Long, sPrompt As String) As String Dim iNull As Integer Dim lpIDList As Long Dim lResult As Long Dim sPath As String Dim udtBI As BROWSEINFO With udtBI .hwndOwner = hwndOwner .lpszTitle = lstrcat(sPrompt, "") .ulFlags = BIF_RETURNONLYFSDIRS End With lpIDList = SHBrowseForFolder(udtBI) If lpIDList Then sPath = String$(MAX_PATH, 0) lResult = SHGetPathFromIDList(lpIDList, sPath) Call CoTaskMemFree(lpIDList) iNull = InStr(sPath, vbNullChar) If iNull Then sPath = Left$(sPath, iNull - 1) End If End If BrowseForFolder = sPath End Function """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""''' -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Wednesday, 9 February 2005 2:37 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Selecting a directory I have used the ADH FindFile module and function for ages. However I also need to select a directory (to copy a file to for example) and the ADH code only allows selecting a file, not a dir. Is there any way to cause that code to select a directory? Is there another module / function to use the fileFind dialog to select a directory? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com