Extracting Data from Text File - Identify starting point then skip down x number of lines to get to first line to extract

  • Hello.


    I am working toward a system to loop through a folder of text files while comparing file names to a list in an Excel worksheet. If a file name is in the list, I need to extract five fields of data from the text file and paste into fields on the same row in the list. So far I can extract the fields from a text file (by specifying the name of the text file in the code--I cannot loop yet) and put the data in the correct fields of the Excel file.

    The immediate issue is that there are two sets of data using the same words, one set in the top half of the page and the other in the bottom half. The code I have pulls from the first set, but the data I need for reconciliation is in the second set, below the words "Output Financial Values - -", which is Documents, Gross Amount, Agency Discount, Tax 1 Amount and Total Invoice Amount. Can someone help me start the extraction after "Output Financial Values - -"? I've attached a sample workbook and two text files.


  • This is the code I have so far, but it needs to begin extracting text after the "Output Financial Values --" in the image above.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!