MartyConnelly
martyconnelly at shaw.ca
Wed Feb 9 17:54:12 CST 2005
Here is one I use but if you want to go up a directory you can't, one
reason being to stop users going to places like network neighbourhood
Needs IE installed. You can also use this to grab filnames from a directory.
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/browseforfolder.asp
'SHDOC401.DLL for IE5
'?fnShellBrowseForFolder("c:\access files")
Function fnShellBrowseForFolder(strRootPath)
Dim objShell
Dim objFolder
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Example Select
Folder", 0, strRootPath)
If (Not objFolder Is Nothing) Then
'Add code here.
Debug.Print objFolder.Title
Debug.Print
objFolder.ParentFolder.ParseName(objFolder.Title).Path
End If
Set objFolder = Nothing
Set objShell = Nothing
End Function
or
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/browseforfolder.asp
'SHDOC401.DLL for IE5
Function fnShellBrowseForFolderWindows()
Dim objShell
Dim ssfWINDOWS
Dim objFolder
ssfWINDOWS = 36
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Example Select
Folder", 0, ssfWINDOWS)
If (Not objFolder Is Nothing) Then
'Add code here.
Debug.Print objFolder.Title
Debug.Print
objFolder.ParentFolder.ParseName(objFolder.Title).Path
End If
Set objFolder = Nothing
Set objShell = Nothing
End Function
Gustav Brock wrote:
>Hi John
>
>This link might interest you:
>
>http://www.lebans.com/callbackbrowser.htm
>
>note the link there to vbnet.
>
>Also, a German guy, Karsten Pries, has a class module for this which we
>use here after a major brush up, but it might be what you are looking
>for:
>
>http://www.karstenpries.de/
>
>Look for FileDialog. Most of it is in German, but I'm sure you can
>figure it out.
>
>/gustav
>
>
>
>>>>jwcolby at colbyconsulting.com 09-02-2005 04:36:59 >>>
>>>>
>>>>
>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
>
>
>
--
Marty Connelly
Victoria, B.C.
Canada