+ Reply to Thread
Results 1 to 7 of 7

find all the excel files in a folder.

  1. #1
    Registered User
    Join Date
    07-20-2005
    Posts
    6

    find all the excel files in a folder.

    i have a windows xp directory and in which hundereds of excel file resides. Some of those files are empty. is there a code any one of you all have that can search through the entire directory and find all those files and highlight them or move them to another folder. I would truly appreciate some help here.
    Thanks.
    Stasi D

  2. #2
    Registered User
    Join Date
    05-20-2004
    Posts
    6

    Try this dude

    Sub Locate_XLS_Files()

    Dim path1 As String
    Dim bStart, bFinish, FS

    Set FS = CreateObject("Scripting.FileSystemObject")

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    bStart = Timer

    path1 = "C:\myfolder\"

    With Application.FileSearch
    .NewSearch
    .LookIn = path1
    .SearchSubFolders = False
    .FileType = msoFileTypeExcelWorkbooks
    .Execute

    b = .FoundFiles.Count

    For f = 1 To b

    Application.StatusBar = "I have found this file - " & .FoundFiles(f)

    Next

    End With

    bFinish = Timer
    Application.StatusBar = "Loop completed in - " & Round((bFinish - bStart) / 60, 2) & " minutes"

    End Sub

  3. #3
    Registered User
    Join Date
    07-20-2005
    Posts
    6
    Thanks. But where do I cut and paste your code. I am so sorry if I am being to green but its a task for me. Thanks again.

  4. #4
    STEVE BELL
    Guest

    Re: find all the excel files in a folder.

    The code supplied by FastOneBaz is a stand alone macro that goes into a
    standard module;
    or into a button click macro.

    You call it with a button or with Run Macro.

    Let us know if you need more help with this...

    --
    steveB

    Remove "AYN" from email to respond
    "jackm1" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks. But where do I cut and paste your code. I am so sorry if I am
    > being to green but its a task for me. Thanks again.
    >
    >
    > --
    > jackm1
    > ------------------------------------------------------------------------
    > jackm1's Profile:
    > http://www.excelforum.com/member.php...o&userid=25399
    > View this thread: http://www.excelforum.com/showthread...hreadid=388721
    >




  5. #5
    Registered User
    Join Date
    07-20-2005
    Posts
    6
    steve, thanks for your reply. I am utterly confused here. The code sent may work very well but do I need to put this in a folder where all my 1000 excel files resides.

    here is a more detailed version of the problem

    all files have

    first column, row=date
    third row and all the columns with data.

    emty file defined

    first coulmn=date.
    all othe columns empty.

    Now I need to find all these empty files with dates in the first column but nothing else in the enitre spreadsheet.

    Can I save this macro and then copy it to the folder where all these files are.
    and then run the excel from there, would it find it. how does excel would look outside the spreadsheet into the folder.......

    Thanks for your help.

  6. #6
    Registered User
    Join Date
    07-20-2005
    Posts
    6
    the files are all in .csv format.

  7. #7
    STEVE BELL
    Guest

    Re: find all the excel files in a folder.

    A couple of things -

    The file type will need to be changed to CSV.
    (I am not sure how to do this)

    The code itself can go anywhere you want.

    You can either build a special workbook to hold it. In which case
    you will need to open that workbook to use it.
    Or you could put it in your Personal.xls (this opens automatically
    everytime you open Excel.

    --
    steveB

    Remove "AYN" from email to respond
    "jackm1" <[email protected]> wrote in
    message news:[email protected]...
    >
    > the files are all in .csv format.
    >
    >
    > --
    > jackm1
    > ------------------------------------------------------------------------
    > jackm1's Profile:
    > http://www.excelforum.com/member.php...o&userid=25399
    > View this thread: http://www.excelforum.com/showthread...hreadid=388721
    >




+ Reply to Thread

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