|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Automate copying of specific content from a word file to another template word file
Greetings everyone,
Recently I have come across the laborious task of copying specific content from a word file and pasting them in specific places on another word file. This is an activity where an organization is updating the format of their SOPs. I have the new template and I also have the old SOP files. However these are 200-300 in number and doing this task manually would consume too much time. Is there a way to automate this task using Macro and VBA? Sequence of actions: 1. Open template file. 2. Open old SOP file. 3. Copy specific data from the SOP file. 4. Paste the data to specific places in the template file (this includes headers). 5. Save as the template file giving it the same name as the SOP file with a "new" at the end. 6. Repeat the action 200 times. It could be amazingly helpful if I can just select a folder containing all the old SOP files and after running the code, it creates a new folder with new files on the new format. Any and all tips and suggestions would be highly appreciated. |
#2
|
||||
|
||||
Yes it can be done. If you aren't familiar with creating code though it will be a very large learning exercise.
The tricks are how to get the sequence right and how to identify the chunks (your #3 & #4 steps) CONSISTENTLY. Typically, across 200+ documents, the variation across those files will make it very hard to arrive at a foolproof way of identifying the sections to include. Did you have bookmarks, headings, fields, content controls or some other way to identify content ranges accurately. Are you 100% sure the macro will find those 100% of those parts accurately - if not, what should the macro do? To try and standardise things better, in the case of header content, I would NOT transfer the whole header. Instead, I would make sure my template includes placeholders for variable content (like mapped Content Controls) and then populate that metadata. This will greatly assist in your ability to make sure all docs have the same header layouts.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
macro automatic, vba code, word 16 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word macro to find and paste specific text from a word file into new excel file | John Brito | Word VBA | 5 | 12-21-2022 03:04 AM |
Word automate editing of some fields in the file. | gresh | Word | 1 | 02-12-2021 02:28 PM |
Macro to check the existence of a word docx file and create a new word file with specific content. | staicumihai | Word VBA | 14 | 11-15-2016 01:42 AM |
Word file lost! Only opens old saved file, template | melaniprkin | Word | 1 | 04-24-2013 05:37 PM |