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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve last Date Modified Document... 2

Status
Not open for further replies.

Anthony904

IS-IT--Management
Jul 15, 2004
153
US
I was wondering is it possible create something to retrieve the latest word document.

The word documents (logs) are stored in a sub folder on a shared drive.

The users update these logs.. pulling the latest one to be modified each day.

Instead of having to navigate to the folder then sorting it to retrieve the latest one.. my users want an icon where they can click to retrieve the latest document.

I figure maybe create a script to open the latest document modified.. I'm not to sure how to do this..

any help is appreciated!
Thanks!
 
this might help?

set oFolder=createobject("scripting.filesystemobject").getfolder("d:\test")
For Each aFile In oFolder.Files
If sNewest = "" Then
Set fNewest = aFile
sNewest = aFile.Name
Else
If fNewest.DateCreated < aFile.DateCreated Then
Set fNewest = aFile
End If
End If
Next

Msgbox fNewest.Name
 
Mr Movie..

Is there a way to retrieve the "Date Modified" field instead of the "Date Created" Field?

Thanks!
 
grab yourself the vbscript and wsh help files off MS. file object....


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:
Function ShowFileAccessInfo(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
s = UCase(filespec) & "<BR>"
s = s & "Created: " & f.DateCreated & "<BR>"
s = s & "Last Accessed: " & f.DateLastAccessed & "<BR>"
s = s & "Last Modified: " & f.DateLastModified
ShowFileAccessInfo = s
End Function


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top