C
Colin Chudyk
Hi, I found this code from a while back, and it works great, except that the
browse window isn't modal. Anyone know how to make this window modal?
Other questions:
-Possible to have a folder preselected in the list without using the Root
parameter that doesn't allow you to "go up"?
-Will this code work on all Windows 2000 and XP systems?
Thanks.
Colin
Message 8 in thread
From: Lyle Fairfield ([email protected])
Subject: Re: Browse from Current Folder
View this article only
Newsgroups: comp.databases.ms-access
Date: 2001-01-29 03:28:27 PST
Terry (or anyone else of course)
Care to comment on:
Sub test()
MsgBox getFolder(, , "Pick a Folder")
End Sub
Public Function getFolder(Optional hwnd As Long, _
Optional ByVal Root As String, _
Optional ByVal Description As String = "Folders") As Variant
Dim s As Object
Dim f As Object
Set s = CreateObject("Shell.Application")
If hwnd = 0 Then hwnd = Application.hWndAccessApp
If Root = "" Then Root = CurDir$()
If Right(Root, 1) <> "\" Then Root = Root & "\"
On Error Resume Next
getFolder = s.BrowseForFolder(hwnd, _
Description, _
0, _
Root & vbNullChar & vbNullChar).Items.Item.Path
If Err <> 0 Then getFolder = False
s.Close
Set s = Nothing
End Function
I haven't been following the whole thread and apologize if this is
redundant.
browse window isn't modal. Anyone know how to make this window modal?
Other questions:
-Possible to have a folder preselected in the list without using the Root
parameter that doesn't allow you to "go up"?
-Will this code work on all Windows 2000 and XP systems?
Thanks.
Colin
Message 8 in thread
From: Lyle Fairfield ([email protected])
Subject: Re: Browse from Current Folder
View this article only
Newsgroups: comp.databases.ms-access
Date: 2001-01-29 03:28:27 PST
Terry (or anyone else of course)
Care to comment on:
Sub test()
MsgBox getFolder(, , "Pick a Folder")
End Sub
Public Function getFolder(Optional hwnd As Long, _
Optional ByVal Root As String, _
Optional ByVal Description As String = "Folders") As Variant
Dim s As Object
Dim f As Object
Set s = CreateObject("Shell.Application")
If hwnd = 0 Then hwnd = Application.hWndAccessApp
If Root = "" Then Root = CurDir$()
If Right(Root, 1) <> "\" Then Root = Root & "\"
On Error Resume Next
getFolder = s.BrowseForFolder(hwnd, _
Description, _
0, _
Root & vbNullChar & vbNullChar).Items.Item.Path
If Err <> 0 Then getFolder = False
s.Close
Set s = Nothing
End Function
I haven't been following the whole thread and apologize if this is
redundant.