![]() |
create a file list from a folder?
How do I create a detailed list of files in a directory, with date created,
modified, etc? |
create a file list from a folder?
See http://tinyurl.com/c7wupa for a solution
"Hal239" wrote: How do I create a detailed list of files in a directory, with date created, modified, etc? |
create a file list from a folder?
Press Alt + F11 to open the Visual Basic Editor, click INSERT on the menu and
select MODULE. Paste the following Macro code into the module and modify the value for strPath from "H:\Excel" to whatever drive and folder you're looking in: Sub MyDirFiles() Dim wb As Workbook Dim ws As Worksheet Dim strPath As String Dim strDir As String Dim lngRowOffset As Long Dim strFiledate As String Dim strFileTime As String Dim strFileDateTime As String Set wb = ThisWorkbook Set ws = wb.Worksheets("Sheet1") strPath = "H:\Excel" "Chcnge this value to your path strDir = Dir(strPath & "\*.*") Do While strDir < "" With ws.Range("A1") .Offset(lngRowOffset).Value = strDir strFileDateTime = _ FileDateTime(strPath & "\" & strDir) .Offset(lngRowOffset, 1).Value = _ Left$(strFileDateTime, _ InStr(1, strFileDateTime, " ") - 1) .Offset(lngRowOffset, 2).Value = _ Right$(strFileDateTime, _ Len(strFileDateTime) - _ InStr(1, strFileDateTime, " ")) End With lngRowOffset = lngRowOffset + 1 strDir = Dir Loop Set wb = Nothing Set ws = Nothing End Sub Save and close the VBE and run it from Excel by clicking TOOLS/MACRO/MACROS and selecting MyDirFiles from the list. -- Kevin Backmann "Hal239" wrote: How do I create a detailed list of files in a directory, with date created, modified, etc? |
All times are GMT +1. The time now is 12:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com