Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get date file 2

Status
Not open for further replies.

juanferman

Programmer
Nov 14, 2001
40
US
How can i know the date of a file ?

Thanks
===================
::) Juan F. Sarria
 
Hi Juan,

Try using the FileDateTime function
e.g.
FileDateTime(pathname)

Jon


 
If you need more than just the last modified date you could use the File System Object:


Dim objFSO As New FileSystemObject
Dim objFile As File
Dim dtCreated As Date
Dim dtLastAccessed As Date
Dim dtLastModified As Date
Dim strPath As String

strPath = "c:\test.txt" 'this is the file we want information about

Set objFile = objFSO.GetFile(strPath)
dtCreated = objFile.DateCreated
dtLastAccessed = objFile.DateLastAccessed
dtLastModified = objFile.DateLastModified

MsgBox "File: " & strPath & vbCrLf & _
"Created: " & dtCreated & vbCrLf & _
"Last Accessed: " & dtLastAccessed & vbCrLf & _
"Last Modified: " & dtLastModified & vbCrLf & vbCrLf & _
"Thank you, Come again!"


Set objFile = Nothing
Set objFSO = Nothing


Probably a better way to do this but this might help you out....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top