Consulting

Results 1 to 4 of 4

Thread: Application.GetOpenFilename Dialog Box

  1. #1
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location

    Exclamation Application.GetOpenFilename Dialog Box

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Quote Originally Posted by sheeeng
    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

  3. #3
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    268
    Location
    Nice tip, xld. I'd been wondering myself if that was possible.

  4. #4
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Great help, xld. You make this thread solved....

    Thanks a thousands......!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •