PDA

View Full Version : Solved: use GetOpenFilename with only few files displayed



gonen
08-19-2009, 12:37 AM
I need to display list of files - using GetOpenFilename - but - only files beginning with b*.txt

Any sample or workaround would be appriciated

thanks

Bob Phillips
08-19-2009, 12:47 AM
With Application.FileDialog(msoFileDialogOpen)

.AllowMultiSelect = False
.InitialFileName = "b*.txt"
If .Show = -1 Then

MsgBox .SelectedItems(1)
End If
End With

gonen
08-19-2009, 12:56 AM
Works like a GEM !!!!!


Many thanks !!

gonen
08-19-2009, 01:15 AM
Work like a GEM !!!!!


Many thanks !!

Bob Phillips
08-19-2009, 01:15 AM
Didn't I just do that?

gonen
08-19-2009, 01:17 AM
yes. It's perfect


thanks again

Bob Phillips
08-19-2009, 01:33 AM
It seems we posted at the same time :)

gonen
08-19-2009, 01:37 AM
yep.

little problem I have is that when I switch from one directory to another, it still opens the first directoy.


I switch directories by:

ChDir (....) command

Do I miss a command to close / clear something before running another openfile dialog ?


thanks

Bob Phillips
08-19-2009, 01:54 AM
Use the target directory in the InitialFilename value.

gonen
08-19-2009, 02:56 AM
great. Is it possible to display the opened diaglog window in:doh: "detail view" with "sort descending by date" ?

Bob Phillips
08-19-2009, 03:01 AM
You can get a details view, don't know about date sorted



With Application.FileDialog(msoFileDialogOpen)

.AllowMultiSelect = False
.InitialFileName = "c:\b*.txt"
.InitialView = msoFileDialogViewDetails

If .Show = -1 Then

MsgBox .SelectedItems(1)
End If
End With