×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Reading Excel File Properties Using VBA in Excel

Reading Excel File Properties Using VBA in Excel

Reading Excel File Properties Using VBA in Excel

(OP)
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.

RE: Reading Excel File Properties Using VBA in Excel

This code might work for you:


    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.

RE: Reading Excel File Properties Using VBA in Excel

(OP)
Thanks, joerd:

I'll try it and see how it works for me.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources