From: Patrick Weidener on
I am using CommonDialog to let the user select a file of a certain format.
I have the following problem:

Let's assume that there is a file with the specified file format (let's
call it ".myformat") in the file selection dialog, but there are also
about 50 subfolders visible in the file selection dialog.
Because of the 50 subfolders the 1 selectable file is (for the normal
user) hidden behind 50 subfolders:
The user needs to scroll to the right to see it because folders are
displayed before files.

The normal user does not understand it at first sight.
Is there a way to select the 1 selectable file automatically?
From: MikeD on

"Patrick Weidener" <pawei_nospom(a)gmx.net> wrote in message
news:OHQw8vd7IHA.5440(a)TK2MSFTNGP02.phx.gbl...
>I am using CommonDialog to let the user select a file of a certain format.

First of all, let's clear up a point. You appear to be talking about a
file's extension, which has NOTHING to do with a file's format. You can
change the extension of any file you want but that doesn't change the file
itself. In fact, you can usually still even open the file in its
application. What you lose is the file's association with that app.

> I have the following problem:
>
> Let's assume that there is a file with the specified file format (let's
> call it ".myformat") in the file selection dialog, but there are also
> about 50 subfolders visible in the file selection dialog.
> Because of the 50 subfolders the 1 selectable file is (for the normal
> user) hidden behind 50 subfolders:
> The user needs to scroll to the right to see it because folders are
> displayed before files.
>
> The normal user does not understand it at first sight.
> Is there a way to select the 1 selectable file automatically?


As to your question, I know of no way of actually selecting the file (not
saying you can't do it, mind you), but you can provide the file name to the
dialog before you show it and that name will then appear in the dialog's
file name box. As long as a file by that name does indeed exist in the
folder, all the user has to do is click OK (assuming you're specifying the
FILEMUSTEXIST flag).

--
Mike
Microsoft MVP Visual Basic


From: Patrick Weidener on
Aahh, thanks... FILEMUSTEXIST. :-))
From: RB Smissaert on
You can do this:

Shell "explorer /select," & strFolder & "\" & strFile, vbNormalFocus

But strFolder & "\" & strFile has to be an existing file and I don't think
it takes
wildcards, so you will have to run some code to get the first file in that
folder with
the particular extension and then run the Shell etc. on that file.


RBS


"Patrick Weidener" <pawei_nospom(a)gmx.net> wrote in message
news:OHQw8vd7IHA.5440(a)TK2MSFTNGP02.phx.gbl...
>I am using CommonDialog to let the user select a file of a certain format.
> I have the following problem:
>
> Let's assume that there is a file with the specified file format (let's
> call it ".myformat") in the file selection dialog, but there are also
> about 50 subfolders visible in the file selection dialog.
> Because of the 50 subfolders the 1 selectable file is (for the normal
> user) hidden behind 50 subfolders:
> The user needs to scroll to the right to see it because folders are
> displayed before files.
>
> The normal user does not understand it at first sight.
> Is there a way to select the 1 selectable file automatically?

From: RB Smissaert on
Ignore that one, you want a dialog result.

RBS


"RB Smissaert" <bartsmissaert(a)blueyonder.co.uk> wrote in message
news:evCwMWe7IHA.1420(a)TK2MSFTNGP06.phx.gbl...
> You can do this:
>
> Shell "explorer /select," & strFolder & "\" & strFile, vbNormalFocus
>
> But strFolder & "\" & strFile has to be an existing file and I don't think
> it takes
> wildcards, so you will have to run some code to get the first file in that
> folder with
> the particular extension and then run the Shell etc. on that file.
>
>
> RBS
>
>
> "Patrick Weidener" <pawei_nospom(a)gmx.net> wrote in message
> news:OHQw8vd7IHA.5440(a)TK2MSFTNGP02.phx.gbl...
>>I am using CommonDialog to let the user select a file of a certain format.
>> I have the following problem:
>>
>> Let's assume that there is a file with the specified file format (let's
>> call it ".myformat") in the file selection dialog, but there are also
>> about 50 subfolders visible in the file selection dialog.
>> Because of the 50 subfolders the 1 selectable file is (for the normal
>> user) hidden behind 50 subfolders:
>> The user needs to scroll to the right to see it because folders are
>> displayed before files.
>>
>> The normal user does not understand it at first sight.
>> Is there a way to select the 1 selectable file automatically?
>