PDA

View Full Version : [SOLVED] Application.GetOpenFilename Dialog Box



sheeeng
06-29-2005, 08:14 PM
Hi all,

Can anyone tell me how to customize the dialog box of Get Open FileName?
How to use the syntax below?

eg. I only would like to open file with the extension of *.abc or *.xyz? How should we write it?
Thanks.



Dim fName As Variant
Dim Sep As String
fName = Application.GetOpenFilename _
(filefilter:="ABC Files (*.abc), *.*, All Files (*.*), *.*")
If fName = False Then
MsgBox "No File Selected"
Exit Sub
End If

Bob Phillips
06-30-2005, 01:17 AM
Hi all,

Can anyone tell me how to customize the dialog box of Get Open FileName?
How to use the syntax below?

eg. I only would like to open file with the extension of *.abc or *.xyz? How should we write it?
Thanks.



Dim fName As Variant
Dim Sep As String
fName = Application.GetOpenFilename _
(filefilter:="ABC Files (*.abc), *.*, All Files (*.*), *.*")
If fName = False Then
MsgBox "No File Selected"
Exit Sub
End If




Dim fName As Variant
Dim Sep As String
fName = Application.GetOpenFilename _
(filefilter:="ABC Files (*.abc),*.abc, XYZ Files (*.xyz),*.xyz")
If fName = False Then
MsgBox "No File Selected"
Exit Sub
End If

They appear as separate entries in the drop-down. To get both at once, use


Dim fName As Variant
Dim Sep As String
fName = Application.GetOpenFilename _
(filefilter:="Sheeng's Files (*.abc;*.xyz),*.abc;*.xyz")
If fName = False Then
MsgBox "No File Selected"
Exit Sub
End If

BlueCactus
06-30-2005, 11:36 AM
Nice tip, xld. I'd been wondering myself if that was possible. :thumb

sheeeng
06-30-2005, 07:56 PM
Great help, xld. You make this thread solved....

Thanks a thousands......!!