Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FindFile Dialog (1)

    Has anyone Used the xldDialogFindFile?
    I want my user to find the file, through the normal dialogs they are used to, but do not want the file opened. This always seems to open the file.

    Thanks in advance

    Cindy

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FindFile Dialog (1)

    Check out Application.GetOpenFilename:

    msgbox Application.GetOpenfileName

    It only yields a string with the complete path and filename the user selected, as the message box shows.

    You should assign this result to a variant, because when Cancel is pressed, the method returns False (which gives an error because it is no string <g>).

    So:

    Option Explicit

    Sub test()
    Dim vFilename As Variant
    vFilename = Application.GetOpenFilename("Microsoft Excel Files (*.xls) , *.xls", , "Please choose a file", , False)
    If TypeName(vFilename) = "Boolean" Then
    MsgBox "Cancelled"
    Exit Sub
    Else
    MsgBox vFilename
    End If
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    63
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FindFile Dialog (1)

    Exactly what I want thank you

Posting Permissions

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