title: Get original creation time for all excel files in a folder
body: <p>I need to loop through a folder containing many excel files and extract the file name and creation time to a text file. By creation time, I mean the time the file was originally created rather than the time it was created on my system.</p>
  
  <p>The following code works, but gives me the wrong time. I think <code>FileDateTime</code> is the wrong command, but after an hour of desperate googling I haven't been able to find the correct one.</p>
  
  <p>Thanks in advance for the help!</p>
  
  <pre><code>Sub CheckFileTimes()
      Dim StrFile As String
      Dim thisBook As String
      Dim creationDate As Date
      Dim outputText As String
      Const ForReading = 1, ForWriting = 2
      Dim fso, f
  
  'set up output file
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set f = fso.OpenTextFile("C:\TEST.txt", ForWriting, True)
  
  'open folder and loop through
      StrFile = Dir("c:\HW\*.xls*")
      Do While Len(StrFile) &gt; 0
  'get creation date
         creationDate = FileDateTime("C:\HW\" &amp; StrFile)
  'get filename
         thisBook = StrFile
         outputText = thisBook &amp; "," &amp; creationDate
  'write to output file
         f.writeLine outputText
  'move to next file in folder
         StrFile = Dir
      Loop
      f.Close
  End Sub
  </code></pre>