Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleGet a file's creation, last access, and last modification times using FSO
Keywordsfile times, modification time, access time, creation time
CategoriesFiles and Directories, Windows, Software Engineering
 
Thanks to Robert Terblanche.

This program contains a reference to the Microsoft Scripting Runtime library (Project\References menu).

At run time, the program creates a FileSystemObject and uses its GetFile method to make a File object corresponding to the target file. The File object's properties give the file's creation, modification, and access times.

 
Private Sub Command1_Click()
Dim FSO As New FileSystemObject
Dim mFile As File

    ' Get the file.
    Set mFile = FSO.GetFile(Text1.Text)

    ' Get the dates.
    lblCreated.Caption = Format$(mFile.DateCreated)
    lblLastModified.Caption = _
        Format$(mFile.DateLastModified)
    lblLastAccessed.Caption = _
        Format$(mFile.DateLastAccessed)

    Set mFile = Nothing
    Set FSO = Nothing
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated