Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try:
Sub StartListFiles() Dim fso As Scripting.FileSystemObject Set fso = New Scripting.FileSystemObject Application.ScreenUpdating = False Worksheets("Sheet1").UsedRange.EntireRow.Delete Call listfiles(Range("Sheet1!A1"), fso.GetFolder("C:\Windows")) End Sub Private Sub listfiles(oRng As Excel.Range, oFld As Scripting.Folder) Dim oFile As Scripting.File Dim oSubFld As Scripting.Folder 'Dump files in excel For Each oFile In oFld.Files If oRng.Row = 65536 Then Set oRng = oRng.Offset(-65535, 12) Else Set oRng = oRng.Offset(1) End If With oFile oRng.Resize(1, 9) = Array(.Name, .ShortName, .Path, _ .DateCreated, .DateLastAccessed, .DateLastModified, _ .Size, .Type, .Attributes) End With Next 'Recurse for subfolders For Each oSubFld In oFld.SubFolders Call listfiles(oRng, oSubFld) Next End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam PeterO wrote : Hi Guys, Many thanks for ythe code, works a treat, it would be great if we could mine down through the sub folder structure. I can live without it, but it would be great. Many Thanks Peter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
LIsting Files in Excel | Excel Discussion (Misc queries) | |||
File path listing and analysis | Excel Discussion (Misc queries) | |||
Want file title listing as in Excel 5.0 File>Find | Excel Discussion (Misc queries) | |||
Unix Directory/File Listing | Excel Programming | |||
Listing all external links within a file | Excel Programming |