Link to home
Start Free TrialLog in
Avatar of 66chawger
66chawgerFlag for United States of America

asked on

Programatically add section of records in a text file

I have a text file that contains thousands of record sets.  For each of these record sets, the last record starts with SE*.

I want to programatically add several records directly before this record in each record set.  

Example: Here is an example of the the record set.  For record set A and B they both end with SE* Record.  I basically need to be able to add 4 additional records before each of the SE* Records.  The records to add are all the same.  So say in my VB macro I run in Word will need to find the first SE* Record, and add the 4 records above it (just call these New record 1, New Record 2, New Record 3....  Then loop through the rest of the file finding each of the remaining SE* Records and add the same 4 records as mentioned previosly.

Record 1a
Record 1b
Record 1c
Record 1d
New Record 1
New Record 2
New Record 3
New Record 4
SE* record
Record 2a
Record 2b
Record 2c
New Record 1
New Record 2
New Record 3
New Record 4
SE* record
:
:
:
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 66chawger

ASKER

So simple... forget sometimes how much you can do with find and replace.
Simple solution.  Worked great!