LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Getting FileSystem Date

I found the code below to read a directory and list the filenames and bytes
into a worksheet. This is great but I also need the file system date for
each file. For the life of me I cannot find the correct property to use.
Here's the code I have that essentially won't give me the file date:

Sub GetAttributes()
On Error Resume Next
Dim FolderPath 'Path to search for files
Dim objFSO 'fileSystemObject
Dim objFolder 'folder object
Dim colFiles 'Collection of files from files method
Dim objFile 'individual file object
Dim ws
Dim x
FolderPath = "C:\batchtest\" ' File Path

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(FolderPath)
Set colFiles = objFolder.Files
Set ws = ActiveWorkbook.Worksheets(1)
x = 1
For Each objFile In colFiles
ws.Cells(x, 1).Value = objFile.Name
ws.Cells(x, 2).Value = objFile.Date
x = x + 1
Next
End Sub


Thanks in advance!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read filesystem shortcut attributes jdawson[_3_] Excel Programming 2 June 16th 06 07:13 PM
FileSystem.RMDIR bill_morgan Excel Programming 2 September 17th 05 05:35 PM
Filesystem again Alvin Hansen[_2_] Excel Programming 1 February 16th 05 10:31 PM
To Bob Phillips ( Filesystem) Alvin Hansen[_2_] Excel Programming 6 February 7th 05 08:27 PM
Filesystem again Alvin Hansen[_2_] Excel Programming 3 January 31st 05 07:55 PM


All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"