Thread: [Solved] Content created date
View Single Post
 
Old 11-02-2014, 11:26 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use a macro like the following from any Office application:
Code:
Sub GetFileStats()
Application.ScreenUpdating = False
Dim FSO As Object, oItem As Object, StrDtTm As String
Dim strPath As String, strFile As String, strFullName As String, strData As String
strPath = GetFolder
If strPath = "" Then Exit Sub
strPath = strPath & "\"
strData = "File Stats For" & vbTab & strPath
If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject")
strFile = Dir(strPath & "*.xls", vbNormal)
While strFile <> ""
  strFullName = strPath & strFile
  Set oItem = FSO.GetFile(strFullName)
  strData = strData & vbCrLf & vbCrLf & "Filename:" & vbTab & strFile & vbCrLf & _
    "Date Created: " & vbTab & Format(oItem.DateCreated, "DD/MMM/YYYY @ hh:mm:ss") & vbCrLf & _
    "Date Last Modified: " & vbTab & Format(oItem.DateLastModified, "DD/MMM/YYYY @ hh:mm:ss")
  strFile = Dir()
Wend
Open strPath & "FileStats.txt" For Output As #1
Print #1, strData
Close #1
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
The output is sent to the folder concerned.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote