Need to Extract from NotePad by searching the Trace Number

New Text Document.txt (991 Bytes)
I need to extract specific Company Name, Company ID, Recv DFI
If I search Trace Number

Like if I search 00000000000002 in notepad . I want Company Name, Company ID, Recv DFI ,Account Number , Amount from that row

It is similar to a fixed length file but not quite. It looks like the columns are different depending on the value of TYP.

  • Build Data Table with all possible columns for both TYP values
  • Read Text File into a string variable
  • For Each on Split(textFileVar,VbCrLf) - this gets you an array where each element is a line in the file
    ** If NOT {“”,“TYP”}.Contains(Left(currentItem,4).Trim)
    *** Then If Left(currentItem,3).Trim = “5”
    **** Add Data Row, using substring to get each currentItem value into the individual columns for TYP 5 in ArrayRow
    *** Else
    **** Add Data Row, using substring to get each currentItem value into the individual columns for TYP 6 in ArrayRow
    *** Else it’s a blank line or header line

Now you’ll have it as a proper datatable and can work with it from there to complete your process.

1 Like

@Sayed_Tabrez2,

Posting the question multiple time will not help here but will get you blocked. Have some patience as someone will take some time out of their own work and help you out as per their capability.

Till that time you can try on your own and share any error you are facing.

Thanks,
Ashok :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.