#1
|
|||
|
|||
Update fields with varying information across multiple files
Hello --
I have a set of about 200 Word files, all built off the same template. Each contains several custom properties that are unique to each file such as a document ID, release date, and version. These properties are reflected in fields that appear both in the body of the documents as well as in the headers and footers. I have all the metadata in a spreadsheet, but I need to merge it into the files themselves. Does a VBA solution (or something else) exist to attack such a problem? Happy to provide more details if necessary. Thanks, Steve |
#2
|
|||
|
|||
See the articles about Document Properties in this MVP FAQ index page:
Word Macros and Visual Basic for Applications (VBA) FAQ You are first updating the properties. Are you sure you need to update the fields? That will require opening each file. Here are links to two free utilities for batch handling files. You can use them to run your code. |
#3
|
|||
|
|||
Thanks for the pointers, Charles. Unfortunately getting access to the document properties is only half the problem, because the docs have different metadata -- for example, each document has a different ID, a different release date, and a different version. It seems to me (and maybe I'm missing something) that the links you provided all assume I'm making the same modifications in all the documents. What I was hoping for is some way to tie the VBA to an Excel sheet or some other source that contains all that info. Do you think that's possible?
|
#4
|
||||
|
||||
Steve,
Yes it is possible but it isn't completely trivial and there isn't a one-size fits all solution. There are multiple places where metadata can be saved (custom xml, built-in and custom document properties, document variables) and because of this, there are multiple ways to connect content in the document to those document variables. Are you looking for a big-bang approach macro to CREATE all 200 documents at once or do the documents already exist and you want to have them REFRESH their variables from the Excel source? Option 1 is more straightforward since you will have consistent structure to work from. If the documents already exist then there is a lot of extra validation that must take place to ensure the 200 docs contain what the macro expects. From your post, it appears you already have the 200 docs and want to refresh the metadata. Charles' links are directly applicable to that 'process' but you will need to use the vba framework available in those links to process the Excel data and update it in each of the relevant docs. If you need assistance to get going on this, you will need to post a sample Excel workbook and a representative Word document so that we can see where the metadata is being saved in the Word docs. If the field titles don't match in both the source spreadsheet and Word docs then we would need a mapping table as well.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Include multiple (but varying in number) Excel rows in each separate email | mrjimi | Mail Merge | 3 | 12-10-2017 09:45 AM |
Summarise information from multiple worksheets in multiple files | alistair_ | Excel Programming | 5 | 04-10-2017 08:27 AM |
Macro to open Multiple files and copy information to a master file | gbaker | Excel Programming | 2 | 04-08-2016 08:44 AM |
I want to use formula to auto update cells with information | Steve81uk | Excel | 15 | 01-09-2015 12:58 PM |
auto populate fields for multiple files w/in folder | jbyrd | Word | 0 | 07-21-2014 07:35 AM |