Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMPRODUCT - Tweak Sam via OfficeKB.com Excel Worksheet Functions 2 September 6th 07 04:12 PM
Does anyone know how to tweak Custom Auto Filter box? [email protected] New Users to Excel 4 July 5th 07 03:48 PM
Array Help Tweak Luke Excel Worksheet Functions 13 November 22nd 06 10:29 AM
Turning a text file name into a search and linking the file as a hyperlink AlistairM Excel Discussion (Misc queries) 1 January 26th 06 04:55 AM
Can someone please tweak my Macro? Wibs Excel Discussion (Misc queries) 3 December 15th 05 05:10 PM


All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"