Results 1 to 3 of 3

List Search Time & Then List Next Search Results on Next Available Line

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    List Search Time & Then List Next Search Results on Next Available Line

    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:

    1. A way of Starting the Macro.
    2. A way to insert two clear columns below the search results.
    3. A timer to rerun the file search 60 seconds after its last search.
    4. List the new files below the 2 clear rows created earlier.
    5. & Repeat.
    6. 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
    Attached Files Attached Files
    Last edited by R_S_6; 03-05-2009 at 09:36 AM. Reason: Change Title!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1