LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default File listing in excel

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
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
LIsting Files in Excel Sudhir Amin[_2_] Excel Discussion (Misc queries) 1 January 17th 08 02:56 PM
File path listing and analysis DaveyC Excel Discussion (Misc queries) 3 December 20th 07 01:36 PM
Want file title listing as in Excel 5.0 File>Find jeffbro27707 Excel Discussion (Misc queries) 0 April 30th 05 07:31 PM
Unix Directory/File Listing enchilada Excel Programming 0 December 10th 03 07:46 AM
Listing all external links within a file Clayton McGuire Excel Programming 3 August 20th 03 10:04 AM


All times are GMT +1. The time now is 02:12 AM.

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

About Us

"It's about Microsoft Excel"