A long time back, with all your help I managed to get the below code working:
What does the
current code do?
It searches a predefined folder for all files of a chosen file extension and lists them in column A at Time T=0. It then
repeats the process leaving a gap of one row before re-lisiting the file names in the same folder again. This repetition is
defined for every xxx sections up to yyy hours. At current for each block of file names found it lists the date and time
found in columns B & C respectively on the first Row of the Search block.
Additions I would like to have in
I would like the date and time to be listed along side every file name found for a given Time, not just the first of the file
I would also like to introduce the File Size of each of the file names found in Column D of the spreadsheet.
Static FunctionOn As Boolean
Static StartTime As Date
Dim Timer1 As Date
If FunctionOn = False Then
FunctionOn = True
StartTime = Now() 'If Not defined
Timer1 = Now + TimeValue("00:00:30") 'Every 30 seconds
If Now() - StartTime > TimeValue("03:00:00") Then '03 Hours
FunctionOn = False
Extension = ""
' Folder to look in.
Folder = "OddjobGCreactiveCRE_10_387HM8.6"
First = True
RowCount = Range("A" & Rows.Count - 18).End(xlUp).Row + 2
Range("B" & RowCount).Value = Format(Now(), "dd-mm-yy")
Range("C" & RowCount).Value = Format(Now(), "hh:mm:ss")
If First = True Then
FName = Dir(Folder & "" & Extension)
First = False
FName = Dir()
If FName <> "" Then
Range("A" & RowCount) = FName
RowCount = RowCount + 1
Loop While FName <> ""
Debug.Print "Time to go: " & _
Format(StartTime + TimeValue("01:10:00") - Now(), "hh:mm:ss")
Application.OnTime Timer1, "Timer"
The point of the spreadsheet is to gauge a Run process of a job I have running on my machine. I hope to do this by looking at
the size of certain files with respect to time.
Any help would be appreciated.
Many Thanks, Mark