Results 1 to 7 of 7

Search for old files by last accessed from a designated folder

Threaded View

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Search for old files by last accessed from a designated folder

    I want users to be able to see a list of files they last accessed over a period of time, then to select through a multiselect listbox and kill the files. My problem comes when trying to import the last accessed date along with the file details(Which the code below does quite adequately). The displaying and killing of the files isn't a problem it's just finding the last accessed date and display in the column next to the file details. This my first post so please be nice to me. Thanks in advance Dave
    Private Sub Searchfile_Click()
        Dim fs As FileSearch, ws As Worksheet, i As Long
        Set fs = Application.FileSearch
        With fs
            .SearchSubFolders = True
            .FileType = msoFileTypeAllFiles
            .LookIn = "C:\Users\Documents" 'modify this to where you want to serach
            If .Execute > 0 Then
                Set ws = Sheets("Sheet1")
                For i = 1 To .FoundFiles.Count
                    ws.Cells(i, 1) = .FoundFiles(i)
                       Next
            Else
                 MsgBox "No files found"
            End If
        End With
    End Sub
    Last edited by Leith Ross; 03-24-2010 at 05:46 PM. Reason: Addded Code Tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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