Page 1 of 1
Macro to combine multiple files into one
Posted: 2024-06-08 16:29:12
by NisusUser
I would like to find a way to take scores of 2-4 page .rtf files in one folder and combine them into one file in the order of the file names (the filenames start with prefixes such as 01.01, 01.02, 02.01, etc.)
I actually do not need a combined .rtf file. Rather, I need a PDF of the content of all of those .rtf files in order.
(The folder has lots of other files with other suffixes besides .rtf files.)
Is there a quick way to do this?
Thanks!
Re: Macro to combine multiple files into one
Posted: 2024-06-09 01:01:51
by phspaelti
A quick way?
Here is a macro that should work according to your specs, as far as I can make them out.
The pdfs will be saved in the same folder with the name with the prefix removed.
Re: Macro to combine multiple files into one
Posted: 2024-06-09 03:39:58
by NisusUser
phspaelti wrote: ↑2024-06-09 01:01:51
A quick way?
Here is a macro that should work according to your specs, as far as I can make them out.
The pdfs will be saved in the same folder with the name with the prefix removed.
Thank you, Philip!
The macro required that I select a folder, so I selected the folder where all the files are. But then it gave me this error:

- errorwithmacro_w350.png (39.1 KiB) Viewed 8355 times
I think the macro failed to ask me where to save the file or the file name. I guess it would be good if it would let me choose a file name.
I really appreciate your help with this!
Re: Macro to combine multiple files into one
Posted: 2024-06-09 04:12:23
by phspaelti
If it gives you this error, I must assume that the files are named in a way different from what I took to be your description.
The macro here assumes that your files have names like this:
01.01myfile.rtf
01.02myfile.rtf
02.01myotherfile.rtf
… and so on.
Maybe you should give a more concrete example of how the files are named?
Re: Macro to combine multiple files into one
Posted: 2024-06-09 04:25:18
by NisusUser
phspaelti wrote: ↑2024-06-09 04:12:23
Maybe you should give a more concrete example of how the files are named?
I probably misled you somehow.
OK, I'll send a screenshot to you personally, but here are some things I observed:
All files start with
Sometimes there are
and
Other than the letters after the numbers, in all other cases that I observed, there always is a space after the second set of two numbers (.##space).