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: 3
Default Odd results getting files properties

Can anyone explain to me why the list resulting from the
following code should return answers such as:

File Created Modified Accessed
Name 16/2/02 30/8/02 13/11/01

Needless to say it is the Accessed reply that throws me
being 3 months before the created date!!

'Code from here
Sub File_Spec()
Dim f
Dim pName As String 'Path name
Dim fName As String 'File name

pName = Application.GetOpenFilename(Title:="Select a file
in the directory to report on:")

For f = Len(pName) To 1 Step -1
If Mid(pName, f, 1) = "\" Then
pName = Left(pName, f)
Exit For
End If
Next f

fName = Dir(pName & "*.*")
ActiveWorkbook.Worksheets.Add
Cells(1, 1) = "File name"
Cells(1, 2) = "Date Created"
Cells(1, 3) = "Date Last Accessed"
Cells(1, 4) = "Date Last Modified"
Cells(1, 5) = "Path"

Do While (Len(fName) 0)
fName = Dir()
If (Len(fName) 0) And ((fName < ".") And (fName
< "..")) Then
ShowFileAccessInfo fName, pName
End If
Loop
Columns("A:E").AutoFit
End Sub

Sub ShowFileAccessInfo(filespec, pathspec)
Dim fs, f, s
Dim r
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(pathspec & filespec)
r = ActiveSheet.UsedRange.Rows.Count + 1
Cells(r, 1) = filespec
Cells(r, 2) = f.DateCreated
Cells(r, 3) = f.DateLastAccessed
Cells(r, 4) = f.DateLastModified
Cells(r, 5) = pathspec
End Sub
 
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
Comment Box in Properties of Excel files [email protected] Excel Discussion (Misc queries) 0 July 27th 06 02:38 AM
check properties of 400 Excel files Mark Excel Discussion (Misc queries) 2 June 8th 05 02:58 PM
Files properties Ron de Bruin Excel Programming 0 June 8th 04 02:29 PM
Files properties Pete McCosh Excel Programming 0 June 8th 04 11:27 AM
Accessing document properties of non-Microsoft product files Kevin Beckham Excel Programming 5 November 5th 03 01:36 AM


All times are GMT +1. The time now is 03:02 AM.

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

About Us

"It's about Microsoft Excel"