From: williamkow on 6 Jun 2010 07:59 There are 2 text files: (1) Text file with 4 columns, each fields are separated by tab-delimited. Each line represent one record. (2) Text file with 1 column only, it is a list of the data for look-up. I wish to read the data in third column (field) in the first text file, and then check against the second text file. If the data can be found in the second text file, then read next line in first text file. If the data cannot be found in the second text file, then this field content will be replaced with a fixed text (hardcoded). Please advice and many thanks in advance.
From: Pegasus [MVP] on 6 Jun 2010 08:18 "williamkow" <williamkow(a)discussions.microsoft.com> wrote in message news:66D8B4EB-7860-45B9-B002-70C94B3BE212(a)microsoft.com... > There are 2 text files: > > (1) Text file with 4 columns, each fields are separated by tab-delimited. > Each line represent one record. > > (2) Text file with 1 column only, it is a list of the data for look-up. > > I wish to read the data in third column (field) in the first text file, > and > then check against the second text file. > > If the data can be found in the second text file, then read next line in > first text file. > > If the data cannot be found in the second text file, then this field > content > will be replaced with a fixed text (hardcoded). > > Please advice and many thanks in advance. Let's have a look at the code you've got so far. As a general hint: To process tab-delimited strings, use the Split function.
From: Mayayana on 6 Jun 2010 10:42 I'd proceed along the lines of Pegasus's hint: Read in the file, use Split with vbCrLf to get an array of lines, then use Split with Chr(9) (tab) to get an array of fields for each record. From there you can access and handle the data easily. | There are 2 text files: | | (1) Text file with 4 columns, each fields are separated by tab-delimited. | Each line represent one record. | | (2) Text file with 1 column only, it is a list of the data for look-up. | | I wish to read the data in third column (field) in the first text file, and | then check against the second text file. | | If the data can be found in the second text file, then read next line in | first text file. | | If the data cannot be found in the second text file, then this field content | will be replaced with a fixed text (hardcoded). | | Please advice and many thanks in advance.
|
Pages: 1 Prev: Simple hack to get $500 to your home. Next: Setting mouse drag height and width |