Get the properties from a closed file

  • Thread starter Thread starter ericsson
  • Start date Start date
E

ericsson

Hi

Does anyone no some way to get the properties Created: , Modified: and
accessed: from a closed excelfile by a VBA macro.

//Lasse
 
Hi,

You can use code as under - modify the filename with full path, as
needed.

Sub FileProps()
Dim fs
Dim dtCreated As Date, dtModified As Date, dtAccessed As Date
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetFile("c:\Book1.xls")
dtCreated = d.DateCreated
dtModified = d.DateLastModified
dtAccessed = d.DateLastAccessed
MsgBox "Created on " & dtCreated & ", Last Modified on " & _
dtModified & ", Last Accessed on " & dtAccessed

End Sub

Sharad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top