Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default File Searches

I want to be able to search for all excel and word files
on my computer and capture the file path, the file name,
date last modified and file size. Is this easy to do? Does
anyone have a piece of code that already does this? I know
it seems like I am after a free bit of code and for
someone to do the work for me, but I really do not know
where to start with this.

Many thanks for any support you can give.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default File Searches

Try this one

See the help for FileType


Sub Test2()
Dim i As Long
With Application.FileSearch
.NewSearch
.LookIn = "c:\Data"
.SearchSubFolders = False
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = .FoundFiles(i)
Cells(i, 2).Value = FileDateTime(.FoundFiles(i))
Cells(i, 3).Value = FileLen(.FoundFiles(i))
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Paul Gurdin" wrote in message ...
I want to be able to search for all excel and word files
on my computer and capture the file path, the file name,
date last modified and file size. Is this easy to do? Does
anyone have a piece of code that already does this? I know
it seems like I am after a free bit of code and for
someone to do the work for me, but I really do not know
where to start with this.

Many thanks for any support you can give.



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
Vlookup with two searches Jack Excel Discussion (Misc queries) 4 August 5th 08 05:41 PM
Getting valid web searches and avoiding sites that contaminate web searches David McRitchie New Users to Excel 1 June 13th 06 03:00 AM
Workbook searches jimijam Excel Worksheet Functions 0 February 17th 06 04:02 PM
multiple searches? jiwolf Excel Worksheet Functions 1 January 26th 06 08:49 PM
Searches peterrump Excel Worksheet Functions 4 May 23rd 05 09:02 PM


All times are GMT +1. The time now is 12:33 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"