#1
|
|||
|
|||
Copy all text files in alphabetical order to a single text file
I'm trying to copy a number of *.TXT to a single *.TXT. The files to be copied are in alphabetical order, but in the combined file the order is different. Can someone help? Thanks!
Code:
Public Sub CombineFilesRN() Shell Environ$("COMSPEC") & " /c Copy C:\FOLDER_RN\FOLDER30\*.txt _ C:\FOLDER_RN\FOLDER30\TXT_TXT\CombinedFile.txt" End Sub |
#2
|
||||
|
||||
Your line continuation errors when I copy/paste code. Can't break a string between lines like that. Need closing and opening quote marks and & character.
Code works for me. Data in combined file is grouped in the alphabetical order of the original file names. You need to clarify issue. Suggest you provide example of files as well as file names. Either as text in post or attached files. |
#3
|
|||
|
|||
Sorry for the continuation error, in the original there is no break. Now I suspect that one or two txt files are not in alphabetical order because they were added later to the folder. I must find an alternative coding. Many thanks, June7!
|
#4
|
||||
|
||||
See Insert a selection of documents which will do what you require.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Many thanks, Gmayor! I will certainly use your site when I need to insert a batch of files into a Word document. Season's Greetings from RobiNew.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Alphabetical order | donnje | Word | 2 | 07-08-2023 06:32 AM |
Note books in alphabetical order | Jazz | OneNote | 0 | 08-07-2017 10:24 AM |
Right to left text, letter order gets reversed when copy pasting. | Salvia | Word | 1 | 05-26-2013 05:19 PM |
O 2007 folders & files lose alphabetical order in | John Seed | Outlook | 0 | 02-28-2012 05:56 PM |
Find in alphabetical order list | 14spar15 | Word | 1 | 12-03-2011 03:01 PM |