Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA File Search Function tweak
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA File Search Function tweak
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) "Nate" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SUMPRODUCT - Tweak | Excel Worksheet Functions | |||
Does anyone know how to tweak Custom Auto Filter box? | New Users to Excel | |||
Array Help Tweak | Excel Worksheet Functions | |||
Turning a text file name into a search and linking the file as a hyperlink | Excel Discussion (Misc queries) | |||
Can someone please tweak my Macro? | Excel Discussion (Misc queries) |