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.
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
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
I'll try it and see how it works for me.