Browse folders (1 Viewer)

marlan

Registered User.
Local time
Today, 12:36
Joined
Jan 19, 2010
Messages
409
Browse, select and create folders

Hi everybody!

In my app. I would like my user to select a folder (directory), containing, or not containing files. I would also like to let the user create a new folder, if desires to.

I'v seen these posts by ghudson and by Poppa Smurf, and it seems all thay allow is to select a folder, not create a new one.
Is it just an issue of raising the right flag?
Or, is there an other module with an other folder Browser?

TIA!
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:36
Joined
Jan 20, 2009
Messages
12,851
I think the context menu is enabled in the file browse window so the New menu would allow the creation of new objects.
 

marlan

Registered User.
Local time
Today, 12:36
Joined
Jan 19, 2010
Messages
409
Hi Galaxiom,

In the file browser you can create a new object (file or folder/directory), but select only a file. So, if my user wants to select a new folder, he must first crete a new "dummy" file and select it, otherwise the folder will not be selected.

How can i have my user crete a folder and select it?
 

marlan

Registered User.
Local time
Today, 12:36
Joined
Jan 19, 2010
Messages
409
Re: Browse, select and create folders

Tanks Galaxiom, I'm not realy soure why, but the Office solution hasn't worked well, thats why I went for the Win API solution.

Is there an other API solution for a folder browser, where I can have my user create and select a folder?

Or, is there a flag for the above solutions that would allow folder creation and selection?

Thanks again!
 
Last edited:

marlan

Registered User.
Local time
Today, 12:36
Joined
Jan 19, 2010
Messages
409
Hi,

First - as for the link GalaxiomAtHome has referd to, it seems the user must have some references so that it compiles, I find API solutions don't have these problems.

(BTW, how do I create these references in a setup program?)

I have found this code:
Code:
'Credit: Fond at [URL]http://www.vbaexpress.com/kb/getarticle.php?kb_id=284[/URL]
Function BrowseForFolder(Optional OpenAt As Variant) As Variant
'Function purpose:  To Browser for a user selected folder.
'If the "OpenAt" path is provided, open the browser at that directory
'NOTE:  If invalid, it will open at the Desktop level
    Dim ShellApp As Object
    
    'Create a file browser window at the default folder
    Set ShellApp = CreateObject("Shell.Application"). _
        BrowseForFolder(0, "Please choose a folder", 0, OpenAt)
    
    'Set the folder to that selected.  (On error in case cancelled)
    On Error Resume Next
        BrowseForFolder = ShellApp.self.Path
    On Error GoTo 0
    
    'Destroy the Shell Application
    Set ShellApp = Nothing
    
    'Check for invalid or non-entries and send to the Invalid error
    'handler if found
    'Valid selections can begin L: (where L is a letter) or
    '\\ (as in [URL="file://\\servername\sharename"]\\servername\sharename[/URL].  All others are invalid
    Select Case Mid(BrowseForFolder, 2, 1)
        Case Is = ":"
            If Left(BrowseForFolder, 1) = ":" Then GoTo Invalid
        Case Is = "\"
            If Not Left(BrowseForFolder, 1) = "\" Then GoTo Invalid
        Case Else
            GoTo Invalid
    End Select
    
    Exit Function
Invalid:
'If it was determined that the selection was invalid, set to False
    BrowseForFolder = False
End Function

It runs fine, and gives me what I want, but is not API. Does anyone know What references this needs ?
 

speakers_86

Registered User.
Local time
Today, 05:36
Joined
May 17, 2007
Messages
1,919
Attached are three different examples. I hope they will help you. I made none of them.
 

Attachments

  • Proximity Functions.zip
    654.6 KB · Views: 98

Users who are viewing this thread

Top Bottom