Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Thelma Murray   on Oct 05 In MS Office Category.

  
Question Answered By: Olga Allen   on Oct 05

A couple of points.
Do you want the file  name, or full path name?
You SAID you wanted the date  created.
Are you sure you don't want the date last modified? (there IS a difference)
put this into a module:

'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
Option Explicit
Dim fso, fc, f, File, Files
Dim Folder
Sub GetFiles()
Dim rowcnt
Sheets("Sheet1").Select
Range("A2:Z65000").ClearContents
Set fso = CreateObject("Scripting.FileSystemObject")
'------------------------------
 folder  = "c:\"
'------------------------------
rowcnt = 1
Set fc = fso.getfolder(Folder)
For Each File In fc.Files
rowcnt = rowcnt + 1
Cells(rowcnt, 1) = File.Name
Cells(rowcnt, 2) = File.Path
Cells(rowcnt, 3) = File.Size
Cells(rowcnt, 4) = File.datecreated
Cells(rowcnt, 5) = File.datelastmodified
Next File
End Sub
'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

change "Folder = " to the folder you're looking in.
If you want to recursively go through each subfolder, let me know and we can
modify this to be a function that calls itself recursively with the folder
names.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Fiile List From Root Directory Or get search suggestion and latest updates.


Tagged: