I have a macro (can't remember where from, probably the net), that searches within a folder that the user specifies for file types of specified extensions. I have found that by leaving the extension input blank it returns all file types within the designated folder as I require.
What I would like to do is run the macro every say '60' seconds to record file creations within a folder. Therefore I require:
- A way of Starting the Macro.
- A way to insert two clear columns below the search results.
- A timer to rerun the file search 60 seconds after its last search.
- List the new files below the 2 clear rows created earlier.
- & Repeat.
- Finally a stop button or a stop macro after 1hour limit.
The code I mentioned earlier is:
Sub Get_File_Names_Within_Dir()
'File extension to look for.
Extension = "*.dat"
'Folder to look in.
Folder = "C:\Documents and Settings\Mark\My Documents"
First = True
RowCount = 1
Do
If First = True Then
FName = Dir(Folder & "\" & Extension)
First = False
Else
FName = Dir()
End If
If FName <> "" Then
Range("A" & RowCount) = FName
RowCount = RowCount + 1
End If
Loop While FName <> ""
End Sub
If the current date and time that each file was found could be listed in columns B and C respectively it would be great! File names and types should be listed in column A.
I have attached an Example *.xls to show what the outcome should look like.
Hope someone can help,
Cheers
Mark
Bookmarks