Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On my Userform, I am using the listbox to populate it with files from a
directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
http://www.rondebruin.nl/copy3.htm
-- Regards, Tom Ogilvy "Larry" wrote in message ... On my Userform, I am using the listbox to populate it with files from a directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This site is and will be very helpful in the near future in another segment
of The program I am writing; right now I have a populated listbox with txt files and I am trying to merge them into another text file. I appreciate all the help so far. -- Larry E. Brueshaber "Tom Ogilvy" wrote: http://www.rondebruin.nl/copy3.htm -- Regards, Tom Ogilvy "Larry" wrote in message ... On my Userform, I am using the listbox to populate it with files from a directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You mean the listbox has a list of fully qualified filenames for text files
which you want to combine into one large file? Or have you read each file into the listbox sequentially (so the data from all files is in the listbox) and you want to write the list back out to a textfile? -- Regards, Tom Ogilvy "Larry" wrote in message ... This site is and will be very helpful in the near future in another segment of The program I am writing; right now I have a populated listbox with txt files and I am trying to merge them into another text file. I appreciate all the help so far. -- Larry E. Brueshaber "Tom Ogilvy" wrote: http://www.rondebruin.nl/copy3.htm -- Regards, Tom Ogilvy "Larry" wrote in message ... On my Userform, I am using the listbox to populate it with files from a directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
the listbox has a list of fully qualified filenames for text files
which I want to combine into one large file. -- Larry E. Brueshaber "Tom Ogilvy" wrote: You mean the listbox has a list of fully qualified filenames for text files which you want to combine into one large file? Or have you read each file into the listbox sequentially (so the data from all files is in the listbox) and you want to write the list back out to a textfile? -- Regards, Tom Ogilvy "Larry" wrote in message ... This site is and will be very helpful in the near future in another segment of The program I am writing; right now I have a populated listbox with txt files and I am trying to merge them into another text file. I appreciate all the help so far. -- Larry E. Brueshaber "Tom Ogilvy" wrote: http://www.rondebruin.nl/copy3.htm -- Regards, Tom Ogilvy "Larry" wrote in message ... On my Userform, I am using the listbox to populate it with files from a directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assumes the Listbox is from the control toolbox toolbar and is on the
activesheet. Sub AppendFiles1() Dim SourceNum As Integer Dim DestNum As Integer Dim Temp As String Dim SrcName as String Dim lbox as MSForms.Listbox ' If an error occurs, close the files and end the macro. On Error GoTo ErrHandler ' Open the destination text file. DestNum = FreeFile() Open "C:\DEST.TXT" For Append As DestNum set lbox = ActiveSheet.Listbox1 for i = 0 to lbox.Listcount - 1 SrcName = lbox.List(i) if Dir(srcName) < "" then ' Open the source text file. SourceNum = FreeFile() Open srcName For Input As SourceNum ' Read each line of the source file and append it to the ' destination file. Do While Not EOF(SourceNum) Line Input #SourceNum, Temp Print #DestNum, Temp Loop CloseFile: ' Close the source file. Close #DestNum End if ' Dir(srcName) < "" Next i Close #SourceNum Exit Sub ErrHandler: MsgBox "Error # " & Err & ": " & Error(Err) & " " & srcName Resume CloseFile End Sub -- Regards, Tom Ogilvy "Larry" wrote in message ... the listbox has a list of fully qualified filenames for text files which I want to combine into one large file. -- Larry E. Brueshaber "Tom Ogilvy" wrote: You mean the listbox has a list of fully qualified filenames for text files which you want to combine into one large file? Or have you read each file into the listbox sequentially (so the data from all files is in the listbox) and you want to write the list back out to a textfile? -- Regards, Tom Ogilvy "Larry" wrote in message ... This site is and will be very helpful in the near future in another segment of The program I am writing; right now I have a populated listbox with txt files and I am trying to merge them into another text file. I appreciate all the help so far. -- Larry E. Brueshaber "Tom Ogilvy" wrote: http://www.rondebruin.nl/copy3.htm -- Regards, Tom Ogilvy "Larry" wrote in message ... On my Userform, I am using the listbox to populate it with files from a directory. What I am trying to do is open the files and merge them into a single file. I appreciate any help anyone can give me. -- Larry E. Brueshaber |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
merging zip files! | Excel Discussion (Misc queries) | |||
merging two files | Excel Discussion (Misc queries) | |||
Merging files | Excel Programming | |||
Merging two different files | Excel Discussion (Misc queries) | |||
Merging Files | Excel Programming |