Link to home
Start Free TrialLog in
Avatar of msdav
msdav

asked on

Append files using VB6

My VB6 program reads one source text file and distributes its records to a number of output text files.  The amount and count totals for each output file are computed during this distribution process.

The totals need to be included in batch header records and the files appended together thus.  :  Batch header record + file + batch header record + file etc.

Can this be done with VB6 code without having to read and write individual records from one file to another?

Is there a Windows command that the program can call that will append one text file to another?

Avatar of aeklund
aeklund

You can Shell out the "COPY" command, which is one way to do it..

example:

shell "copy " & file + file + file outputfile

The only other way that I know of is to read the contents of each file into variables, then write the entire thing out into your output file.
ASKER CERTIFIED SOLUTION
Avatar of damion69
damion69

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 msdav

ASKER

damion69 answers allows for both file copy and insertion of batch header record information as the "treg" variable - interesting solution!