ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using File System Object to retrieve paths filenames and dates (https://www.excelbanter.com/excel-programming/384365-using-file-system-object-retrieve-paths-filenames-dates.html)

dd

Using File System Object to retrieve paths filenames and dates
 
I have a workbook that works as a fileindex to show paths, files and
hyperlinks ot the files.

Is there a way I can include the date the file was created (date attribute),
as a new column to my worksheet?

DDawson
Scotland



Jim Cone

Using File System Object to retrieve paths filenames and dates
 

The File object has a DateLastModified property...
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(fpath)
str = f.DateLastModified

-or-

The free Excel add-in "List Files" does everything you describe
plus a little bit more. Download from...
http://www.realezsites.com/bus/primitivesoftware
No registration required.
--
Jim Cone
San Francisco, USA


"dd" <dd.dd wrote in message ...
I have a workbook that works as a fileindex to show paths, files and
hyperlinks ot the files.
Is there a way I can include the date the file was created (date attribute),
as a new column to my worksheet?
DDawson
Scotland



joel

Using File System Object to retrieve paths filenames and dates
 
You can use this functtion

Function FileCreateDate(filespec)


Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
FileCreateDate = f.DateCreated

End Function

call it from your worksheet using

=FileCreateDate("c:\temp\book1.xls")

"dd" wrote:

I have a workbook that works as a fileindex to show paths, files and
hyperlinks ot the files.

Is there a way I can include the date the file was created (date attribute),
as a new column to my worksheet?

DDawson
Scotland




dd

Using File System Object to retrieve paths filenames and dates
 
Thanks very much for this.

Is there any way to format the date through VBA.
I want it to show as DD/MM/YY
The spreadsheet formating is not very reliable, some of the dates show the
time of creatiion as well and I can't get rid of it.

Thanks
Dylan
"Joel" wrote in message
...
You can use this functtion

Function FileCreateDate(filespec)


Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
FileCreateDate = f.DateCreated

End Function

call it from your worksheet using

=FileCreateDate("c:\temp\book1.xls")

"dd" wrote:

I have a workbook that works as a fileindex to show paths, files and
hyperlinks ot the files.

Is there a way I can include the date the file was created (date
attribute),
as a new column to my worksheet?

DDawson
Scotland







All times are GMT +1. The time now is 10:26 AM.

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