VBA File Search Function tweak

N

Nate

Hi, I need help tweaking this File Search function to do two things:
1) I want it to automatically execute the two InputBoxes
2) I want it to save the 4 outputted file locations as a variable to
be used later in an Insert statement

Sub Search_files()
Dim FileS As FileSearch
Dim F As Variant
Dim x As Integer
Set FileS = Application.FileSearch
With FileS
.NewSearch
.Filename = InputBox("Insert file name", , "*.jpg")
.LookIn = InputBox("Insert the path", , "C:\abc\def\Download\")
.SearchSubFolders = True
.Execute
End With
x = 1
For Each F In Application.FileSearch.FoundFiles
Cells(x, 1) = F
x = x + 1
Next F
End Sub

Many thanks in advance, _Nate
 
B

Bob Phillips

1) what does automatically execute mean?

2) you already have that in the .FoundFiles collection.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top