Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2024, 12:09 AM
NeoDecimo NeoDecimo is offline Automate copying of specific content from a word file to another template word file Windows 10 Automate copying of specific content from a word file to another template word file Office 2016
Novice
Automate copying of specific content from a word file to another template word file
 
Join Date: Apr 2024
Posts: 1
NeoDecimo is on a distinguished road
Post 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.
Reply With Quote
  #2  
Old 04-21-2024, 05:34 PM
Guessed's Avatar
Guessed Guessed is offline Automate copying of specific content from a word file to another template word file Windows 10 Automate copying of specific content from a word file to another template word file Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,989
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
Reply

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
Automate copying of specific content from a word file to another template word file 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft