Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
reading from another file and pasting to current file, "combobox" | New Users to Excel | |||
Can I import a folder's contents as a dropdown list? | Excel Worksheet Functions | |||
Reading files on a specific folders | Excel Programming | |||
Reading from file | Excel Programming | |||
Reading specific digits from a numeric variable | Excel Programming |