Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Reading a specific Folder's file

Is there any way to read all files in a folder and output
the File name, Date & time, file type, etc. into a
spreasheet?

Thanks in advance!
Jimmy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Reading a specific Folder's file

Hi Jimmy

Run this with a empty sheet active

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
http://www.rondebruin.nl


"Jimmy" wrote in message ...
Is there any way to read all files in a folder and output
the File name, Date & time, file type, etc. into a
spreasheet?

Thanks in advance!
Jimmy



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Reading a specific Folder's file

Thanks!!! That worked..


-----Original Message-----
Hi Jimmy

Run this with a empty sheet active

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
http://www.rondebruin.nl


"Jimmy" wrote in

message ...
Is there any way to read all files in a folder and

output
the File name, Date & time, file type, etc. into a
spreasheet?

Thanks in advance!
Jimmy



.

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
reading from another file and pasting to current file, "combobox" Darius New Users to Excel 1 September 26th 05 07:13 AM
Can I import a folder's contents as a dropdown list? Terp Excel Worksheet Functions 2 August 23rd 05 06:35 PM
Reading files on a specific folders Jaime[_3_] Excel Programming 2 August 11th 04 05:00 PM
Reading from file Asif[_3_] Excel Programming 4 November 16th 03 05:28 AM
Reading specific digits from a numeric variable Srdjan Kovacevic[_2_] Excel Programming 2 October 29th 03 01:54 PM


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