• FindFile Dialog (1)

    Author
    Topic
    #370035

    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

    Viewing 0 reply threads
    Author
    Replies
    • #584258

      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 ).

      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

    Viewing 0 reply threads
    Reply To: FindFile Dialog (1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: