PDA

View Full Version : Solved: Selecting a folder interactively



JimmyTheHand
01-18-2007, 12:07 AM
Hi :hi:

I'm working on a program that processes files in a choosen folder. I want the user to select the folder they want to process by browsing in the folder tree. How do I do this?
For lack of a better idea, I now use a workaround, namely selecting a file by GetOpenFilename, then retrieving the path from the filename.
Public MainFolder as String
Sub SelectFolder()
MainFolder = Application.GetOpenFilename(, , , , False)
MainFolder = Left(MainFolder, InStrRev(MainFolder, "\"))
End Sub Anyone knows of a better way?

Thanks,
Jimmy

Charlize
01-18-2007, 01:41 AM
It must be your lucky day today.

Charlize

JimmyTheHand
01-18-2007, 01:55 AM
It must be your lucky day today.

Charlize

Indeed :yes. Thanks :thumb

BigC
05-02-2007, 10:09 PM
I'm looking for something very similar to the request in this post (i.e. allow the user to select a FOLDER into which a file is to be saved, and return the name of the folder to the sub), but also allowing Shortcuts (to folders) and Favourites to be displayed and used to drill down the folder heirachy. (My client has many levels to their folder structure, but I'd prefer NOT to "hard code" one of the lower level folders into the code in order to reduce the amount of drilling-down required.)

Is this possible? (If not, is it because Shortcuts are treated like files, which I don't want the user to see - only folders?)

johnhlaj
05-08-2007, 06:44 AM
This helped a lot

xld
05-08-2007, 06:53 AM
I'm looking for something very similar to the request in this post (i.e. allow the user to select a FOLDER into which a file is to be saved, and return the name of the folder to the sub), but also allowing Shortcuts (to folders) and Favourites to be displayed and used to drill down the folder heirachy. (My client has many levels to their folder structure, but I'd prefer NOT to "hard code" one of the lower level folders into the code in order to reduce the amount of drilling-down required.)

Is this possible? (If not, is it because Shortcuts are treated like files, which I don't want the user to see - only folders?)

With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show

MsgBox .SelectedItems(1)

End With

JimmyTheHand
05-08-2007, 10:10 AM
Bob,

You never cease to amaze me :thumb :bow:


Jimmy

BigC
05-10-2007, 05:13 PM
Wow! I think this gives me almost all of what I want (no Favourites but no matter) and saved over a page of code.

Many thanks