Filedatetime

captnk

Registered User.
Local time
Today, 17:47
Joined
Dec 12, 2001
Messages
148
Earlier posts and site search have led me to the captioned vb code.

This works fine,and I thought I had solved the problem but , it returns the 'CREATED DATE",so that if I have extracted say 6 (zip) files then all of these have the same created date.
So it has become difficult to rename the files with filedatetime and file name,as all the files have the same timestamp.
What i really need to do is to reference the "MODIFIED DATE",which remains the files true date reference.
Currently I am using the following code:
filedate=filedatetime("directorypath")

Help please
 
The following is from the vba help file:
DateLastModified Property


Description

Returns the date and time that the specified file or folder was last modified. Read-only.

Syntax

object.DateLastModified

The object is always a File or Folder object.

Remarks

The following code illustrates the use of the DateLastModified property with a file:

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub
 

Users who are viewing this thread

Back
Top Bottom