Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Concatenate Text File
Are you saying there is not a command to contatenate two text files i VBA -- RickKenned ----------------------------------------------------------------------- RickKennedy's Profile: http://www.excelforum.com/member.php...fo&userid=1541 View this thread: http://www.excelforum.com/showthread.php?threadid=27029 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Concatenate Text File
shell("copy master.txt + file1.txt file2.txt")
-- Regards, Tom Ogilvy "RickKennedy" wrote in message ... Are you saying there is not a command to contatenate two text files in VBA? -- RickKennedy ------------------------------------------------------------------------ RickKennedy's Profile: http://www.excelforum.com/member.php...o&userid=15419 View this thread: http://www.excelforum.com/showthread...hreadid=270290 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Concatenate Text File
No, there's no single command to do that. However, if the 2nd file is less
than the maximum allowed for a single string (2^31 bytes), you can do this: File1 = "FirstFile.Txt" File2 = "SecondFile.Txt" Open File1 For Binary As #1 Seek #1, LOF(1) + 1 Open File2 For Binary AS #2 X = Space$(LOF(2)) Get #2, 1, X Put #1, , X Close #1, #2 If it's binary data and too big to read into a single string, you would have to read in blocks, most probably adjusting the size of the the string variable when reading the last block. IOW, you would have to keep track of the number of bytes left, and if it's less than the length of X, redefine X to the number of bytes left before the last Get statement. If the 2nd file is too large, and it consists of lines ending with CR/LF, you can do it the old fashioned way: File1 = "FirstFile.Txt" File2 = "SecondFile.Txt" Open File1 For Append As #1 Open File2 For Input AS #2 Do While Not EOF(2) Line Input #2, X Print #1, X Loop Close #1, #2 On Tue, 19 Oct 2004 10:06:35 -0500, RickKennedy wrote: Are you saying there is not a command to contatenate two text files in VBA? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TEXT & DATES & CONCATENATE | Excel Discussion (Misc queries) | |||
How to concatenate cell & text in a text box? | Excel Worksheet Functions | |||
CONCATENATE text formula | Excel Worksheet Functions | |||
Using Concatenate function to generate text in Text Box | Charts and Charting in Excel | |||
Concatenate Text File | Excel Programming |