#1
|
|||
|
|||
Merge one Excel file into multiple Word Documents
Hello, I am trying to find a way to merge one excel spreedsheet into multiple word documents. I have to do this by state because of legal language and currently have to open each document separately and select the lines from the excel sheet. Obviously, with 50 states this can be very time consuming. Is there a way to set it up so that the merge can look at the data in a cell, in this case, I use column AM and each state is always the two letter abbreviation, and have it open a file and merge that line of data before moving on to the next line? |
#2
|
||||
|
||||
You can do this with one letter, using IF fields to vary the output as necessary. For example, such a field might be coded as:
{IF{MERGEFIELD State}= "AZ" "Text for Arizona"}{IF{MERGEFIELD State}= "CA" "Text for California"}, etc. or: {IF«State»= "AZ" "Text for Arizona"}{IF«State»= "CA" "Text for California"}, etc. An individual IF field can contain anything from a single word to multiple paragraphs, tables & images, plus additional mergefields. An alternative approach would be to have the entire text (and any additional mergefields) for each State in separate documents and use an INCLUDETEXT field to pull in the appropriate text. For example: {IF{MERGEFIELD State}= "AZ" {INCLUDETEXT "C:\\FilePath\\Arizona.docx"}}{IF{MERGEFIELD State}= "CA" {INCLUDETEXT "C:\\FilePath\\California.docx"}, etc. or: {IF«State»= "AZ" {INCLUDETEXT "C:\\FilePath\\Arizona.docx"}}{IF«State»= "CA" {INCLUDETEXT "C:\\FilePath\\California.docx"}}, etc. Taken to extremes, the mailmerge main document might contain just the IF fields. Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the 'Insert Merge Field' dropdown. The spaces represented in the field construction are all required.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
outstanding. I will give this a try. Thank you
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
search on multiple word documents | Guy Roth | Word | 7 | 03-06-2017 01:31 PM |
Inputing Text from Excel sheet to multiple Word documents and Visio File | Jazz43 | Office | 1 | 05-30-2013 02:08 PM |
Excel 2007-How to merge multiple records into one | mag | Excel Programming | 1 | 11-21-2012 12:11 AM |
Word count in multiple documents | cyberpaper | Word | 5 | 07-27-2012 07:31 PM |
Word 2010 and Excel 2010 Mail merge - multiple headers | robby | Word | 3 | 04-18-2012 06:37 PM |