We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Calling the Find Files or Folders App

UpAllNite asked
Medium Priority
Last Modified: 2010-05-03
How do you call the Find File or Folders App from a command button?
Watch Question

Private Sub Command1_Click()
    Dim x As Variant
    Dim i As Integer
    x = Shell("Explorer", vbNormalFocus)
    If x <> 0 Then
        SendKeys "^f", True     'Ctrl f to invoke FindFiles from Explorer
        AppActivate "Exploring - C:\"
        SendKeys "%{F4}", True  'Alt F4 to close Explorer
        For i = 1 To 100
        Next i
        AppActivate "Find: All Files"
    End If
End Sub

Did it not work or was it not what you wanted ?


It didn't work because, "Exploring - C:\" isn't always at startup, therefore AppActivate Errors occurr.  Secondly, I wanted to access the Find Files or Folders App without going through Explorer and sending SendKeys.

What I want is a call directly to the Find Files or Folders App.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Replace Form_Load with the following code and delete function sChopStr
It should still work but be a bit simpler

Private Sub Form_Load()
    Dim fh As Integer
    fh = FreeFile
    Open "c:\temp.fnd" For Binary As #fh
    Put #fh, , " "
    Close #fh
End Sub

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.