+ Reply to Thread
Results 1 to 2 of 2

Extract spesific line from more then 2000 txt files!

  1. #1
    Registered User
    Join Date
    12-06-2011
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    1

    Extract spesific line from more then 2000 txt files!

    Hi,

    i' m struggling a bit with extracting a specific line of a txt files.
    I need this info from more then 2000 files.
    The files are all in one folder.

    The files looks like this
    44256_mtestermd_DOC.txt
    44256_mtestermd_PST.txt
    44256_mtestermd_DESK.txt

    Example file:


    Volume in drive C has no label.
    Volume Serial Number is xxxxxxxx

    Directory of C:\Documents and Settings\mkerckwe\Desktop\0017418200 FC Bam [COPY]\Correspondentie-JRO

    24/10/2011 15:57 1.568.424.960 MailbestandenO.pst
    21/11/2011 08:58 564.806.656 MailbestandenO2.pst
    2 File(s) 2.133.231.616 bytes

    Directory of C:\Documents and Settings\mkerckwe\Desktop\002239 FC bla

    21/11/2011 15:30 34.554.880 2239_FCtest_laptop.pst
    1 File(s) 34.554.880 bytes

    Directory of C:\Documents and Settings\mtesx\My Documents

    21/11/2011 14:23 42.681.344 FCtester.pst
    24/10/2011 15:57 331.170.816 Mtesrm.pst
    24/10/2011 15:57 442.909.696 Maitesr3.pst
    3 File(s) 816.761.856 bytes

    Total Files Listed:
    6 File(s) 2.984.548.352 bytes
    0 Dir(s) 19.682.029.568 bytes free
    COMPLETE-----------------------------------------------------

    End example file


    I need the following info from each file and add it to a cell.
    6 File(s)
    2.984.548.352
    if "COMPLETE------------------------------------" is found in the file

    My sheet should look like this:

    A B B C D E F
    1 44256_mtestermd_DOC.txt 44256 mtestermd DOC 2.984.548.352 6 File(s) EOF found
    2

    I hope someone can help me with this.
    Sorry for my bad English!

    Thx in advance!

    Grts,
    DWloko32
    Last edited by dwloko32; 12-08-2011 at 05:12 PM. Reason: added more info

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Extract spesific line from more then 2000 txt files!

    Hello DWloko32,

    Welcome to the Forum!

    This macro will search the directory you specify for all text files matching the naming style you posted. Copy and paste this code into new module in yourworkbook's VBA project.

    You will need to change the directory name in the macro to match what you are using. You may also need to change the worksheet name and the starting cell. Currently these are set to "Sheet1" and "A1".

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

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