Finding the create data of a file

S

Stephen English

I have hundreds of files in a folder that I am reading using the File System
Object. I want to find the CreateDate of the file (i.e the file date as you
see it it Windows Explorer). I don't seem to be able to get it from the
FileSystem Object. Is there another object that will give me this info
please?
Regards
Stephen
 
J

jmonty

This may or may not work. Try:

'The following uses some of the FSO File's properties
'to display information about a file.

Private Sub displayFileInfo(ByVal fileName As String)
Dim fso As New FileSystemObject
Dim fileSpec As File
Dim strInfo As String
Set fileSpec = fso.GetFile(fileName)
strInfo = fileSpec.Name & vbCrLf
strInfo = strInfo & "Created: "
strInfo = strInfo & fileSpec.DateCreated & vbCrLf
strInfo = strInfo & "Last Accessed: "
strInfo = strInfo & fileSpec.DateLastAccessed & vbCrLf
strInfo = strInfo & "Last Modified: "
strInfo = strInfo & fileSpec.DateLastModified
MsgBox strInfo, vbInformation, "File Information"
Set fileSpec = Nothing
End Sub


jmonty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top