Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Reading Excel File Properties Using VBA in Excel 1

Status
Not open for further replies.

mtroche

Civil/Environmental
Jun 4, 2001
39
0
0
PR
Hellow Everyone,

I need help in making a VBA program in Excel to read the Created, Modified and Accessed Date and Time of an Excel file when the same Excel file opens. I know it can be done reading the file properties, but how can I do it?

I'll appreciate any help.
 
Replies continue below

Recommended for you

This code might work for you:

Code:
    Dim fs, f, DC, DLM, DLA
    ' pick one of the 3 options below that works for you:
    'filespec = Application.RecentFiles(1).Path
    'filespec = ActiveWorkbook.FullName
    'filespec = Me.FullName
    '(the last option to be used in a Workbook_Open event procedure)
    'Debug.Print filespec
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    DC = f.DateCreated
    DLM = f.DateLastModified
    DLA = f.DateLastAccessed
    'Debug.Print DC, DLM, DLA
Good luck!

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
 
Status
Not open for further replies.
Back
Top