M
MD
I'm trying to modify Jim Rech's code for Browse for Folder to give me a
spacific display. In one of his functions (code below), he sets the Desktop
as the root directory (5th line). My modification would be that a specific
directory (c:\MyDirectory\MySpecificDirrectory\). I know that we can set
the code to open in that directory, but you have all the upper folders that
makes the "folder tree" really bothersome to display since my folder is on
a network ... deep deep in my network (about 12 sub-folders deep)!! LOL
If you go in Internet Explorer, click on Favorites/Organize favorites and
click on move, you'll the same box that shows the folder without the higher
folders...
Thank you
Michel
'****This is taken from Jim Rech's Browse for Folder********
Function GetDirectory(InitDir As String, Flags As Long, CntrDlg As Boolean,
Msg) As String
Dim bInfo As BROWSEINFO
Dim pidl As Long, lpInitDir As Long
CntrDialog = CntrDlg ''Copy dialog centering setting to module level
variable so callback function can see it
With bInfo
.pidlRoot = 0 'Root folder = Desktop
.lpszTitle = Msg
.ulFlags = Flags
lpInitDir = LocalAlloc(LPTR, Len(InitDir) + 1)
CopyMemory ByVal lpInitDir, ByVal InitDir, Len(InitDir) + 1
.lParam = lpInitDir
If Val(Application.Version) > 8 Then 'Establish the callback
function
.lpfn = BrowseCallBackFuncAddress
Else
.lpfn = AddrOf("BrowseCallBackFunc")
End If
End With
'Display the dialog
pidl = SHBrowseForFolder(bInfo)
'Get path string from pidl
GetDirectory = GetPathFromID(pidl)
CoTaskMemFree pidl
LocalFree lpInitDir
End Function
spacific display. In one of his functions (code below), he sets the Desktop
as the root directory (5th line). My modification would be that a specific
directory (c:\MyDirectory\MySpecificDirrectory\). I know that we can set
the code to open in that directory, but you have all the upper folders that
makes the "folder tree" really bothersome to display since my folder is on
a network ... deep deep in my network (about 12 sub-folders deep)!! LOL
If you go in Internet Explorer, click on Favorites/Organize favorites and
click on move, you'll the same box that shows the folder without the higher
folders...
Thank you
Michel
'****This is taken from Jim Rech's Browse for Folder********
Function GetDirectory(InitDir As String, Flags As Long, CntrDlg As Boolean,
Msg) As String
Dim bInfo As BROWSEINFO
Dim pidl As Long, lpInitDir As Long
CntrDialog = CntrDlg ''Copy dialog centering setting to module level
variable so callback function can see it
With bInfo
.pidlRoot = 0 'Root folder = Desktop
.lpszTitle = Msg
.ulFlags = Flags
lpInitDir = LocalAlloc(LPTR, Len(InitDir) + 1)
CopyMemory ByVal lpInitDir, ByVal InitDir, Len(InitDir) + 1
.lParam = lpInitDir
If Val(Application.Version) > 8 Then 'Establish the callback
function
.lpfn = BrowseCallBackFuncAddress
Else
.lpfn = AddrOf("BrowseCallBackFunc")
End If
End With
'Display the dialog
pidl = SHBrowseForFolder(bInfo)
'Get path string from pidl
GetDirectory = GetPathFromID(pidl)
CoTaskMemFree pidl
LocalFree lpInitDir
End Function