Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

txt file parsing question 1

Status
Not open for further replies.

jsmokey

Technical User
Aug 19, 2005
10
US
Hi,
I just had a quick question. I am trying to take vba code for excel and use it to parse text files. I have a multiselect dialog box that i used to select the certian text files. All i wanted was to take each file selected and copy every line in it, put the copy into another file called "compress.txt". After than close the text file and open the next one that was selected in the multiselect dialog box and do the same. The only thing is that the second and on that are opened need to be added to the very end of the "compress.txt" file, not just write over the data that is in it. The goal here is to take several text files and make them into one huge text file to do stuff with. Anyone know how to do this? thanks guys
 
Simply don't close "compress.txt" before processing the next selected file.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Another option is to open the text file for append not for output. Output will overwrite. Append will add too.



Andy Baldwin

"Testing is the most overlooked programming language on the books!
 
If all you are doing is concatenating the selected txt files you could do the equivalent of the DOS COPY command:
COPY file1.txt + file2.txt + filen.txt compress.txt

Just package this inside a SHELL function and you achieve your result.

Regards, N
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top