ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get the properties from a closed file (https://www.excelbanter.com/excel-programming/318623-get-properties-closed-file.html)

ericsson

Get the properties from a closed file
 
Hi

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

//Lasse







Harald Staff

Get the properties from a closed file
 
Hi Lasse

See
http://support.microsoft.com/default...;EN-US;Q224351
http://www.cpearson.com/excel/docprop.htm

HTH. Best wishes Harald

"ericsson" skrev i melding
...
Hi

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

//Lasse









Sharad

Get the properties from a closed file
 
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



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com