FileDialog Folder selection spec

A

Alan

Is there a way to specify a folder spec when invoking the
FileDialog() to select a folder? I want to display
the "new*" folders and let the user select one of them.

For example:

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.Filters.Add xxxxxxxxx

The "fd.Filters.Add" option appears to work only for file
selection.

Is there another folder selector which supports this?

thanks.
 
H

Harald Staff

Hi

This should in theory direct all excel's "open" and "save" dialogs to the
desired folder:

ChDrive "C:\Temp"
ChDir "C:\Temp"
 
A

Alan

This helps, but doesn't solve the problem.

I have many folders in the desired folder. When the
folder selector is displayed, I want only the folders
which match my filter to be displayed.

For example, if I have the following folders:

C:\Temp\new
C:\Temp\new_1
C:\Temp\new_2
C:\Temp\old
C:\Temp\old_1

When invoking the FileDialog to select a folder, I
first "ChDir C:\Temp", then I want to specify "new* and
display only the "new*" folders in the FileDialog.
The "old*" folders will not be displayed in the
FileDialog. Can this be done?
 
H

Harald Staff

No, I don't think so. A folder is a folder and it doesn't have a custom "relevance"
property. Instead of an Excel dialog, you will have to roll your own control using a
programming suite like Visual Studio. It's prettty simple to do with a treeview if you
know how to -but a true pain to deploy to your users, which probably doesn't have the
necessary user priviledges to install anything.
 
A

Alan

Thanks for the followup. It appears there is not an easy
way to do it and distribute the selector to other users.

As a workaround, I'll move my list of "candidate folders"
to their own folder and use the FileDialog to browse the
container folder.

Thanks for the suggestions.
-----Original Message-----
No, I don't think so. A folder is a folder and it
doesn't have a custom "relevance"
property. Instead of an Excel dialog, you will have to roll your own control using a
programming suite like Visual Studio. It's prettty
simple to do with a treeview if you
know how to -but a true pain to deploy to your users,
which probably doesn't have the
 
Top