BrowseForFolder

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.
 
C

Colin Chudyk

Thanks Doug.

The problem with one from mvps.org/access is that while it is modal, there
isn't a button for creating new folders. That's why I was happy to discover
BrowseForFolder. But it's not a modal dialog, and that worries me....

Colin
 
T

Terry Kreft

Hmm, Using the code below I get an application modal dialog but no way of
creating folders (this is using AccessXP on Win2000).

What OS/Access version aare you using?


Terry
 
C

Colin D. Chudyk

Terry:

Using Windows XP with Access XP I get a non-modal dialog, and a button
titled Make New Folder. I just tried it on W2K now, and there is no
button to create a new folder, and the dialog is still not application
modal...

Colin
 
T

Terry Kreft

Colin,
This is probably down to different versions of shell32.dll.

If that is the case then you have a few choices
1) go with this version which has varying results.
2) go with the mvps/access api version which has predictable results
3) role your own browse dialog box
(you can get code snippets for this from mvps.org/access)


Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top