KeyserSoze
Programmer
Is there code in Microsoft Access 2003 that will display a directory tree dialog box that will allow a user to choose a directory and populate a text box with the name of the chosen directory?
Thanks!
Thanks!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function SelectAFolder(Title, TopFolder) As String
Dim objShell As Shell
Dim objFolder As Shell32.Folder
Dim objFolderItem As Shell32.FolderItem
Const WINDOW_HANDLE = 0
Const OPTIONS = 1
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, Title, OPTIONS, TopFolder)
If objFolder Is Nothing Then
Exit Function
End If
Set objFolderItem = objFolder.Self
SelectAFolder = objFolderItem.Path
'Debug.Print objPath
End Function
DirStr = SelectAFolder("title", top folder name)
Function PickFolder(strStartDir As Variant) As String
Dim SA As Object, f As Object
Set SA = CreateObject("Shell.Application")
Set f = SA.BrowseForFolder(0, "Choose a folder", 16 + 32 + 64, strStartDir)
If (Not f Is Nothing) Then
PickFolder = f.Items.Item.path
End If
Set f = Nothing
Set SA = Nothing
End Function
Dim objShell As Shell
Dim objFolder As Shell32.Folder
Dim objFolderItem As Shell32.FolderItem
Const WINDOW_HANDLE = 0
Const OPTIONS = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(17)
Set objFolderItem = objFolder.Self
SelectAFolder = objFolderItem.Path
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, Title, OPTIONS, SelectAFolder)
If objFolder Is Nothing Then
Exit Function
End If
Set objFolderItem = objFolder.Self
SelectAFolder = objFolderItem.Path