Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2020, 08:53 AM
mallorious mallorious is offline Customize document content based on Mail Merge source fields? Windows 10 Customize document content based on Mail Merge source fields? Office 2019
Novice
Customize document content based on Mail Merge source fields?
 
Join Date: Sep 2020
Posts: 2
mallorious is on a distinguished road
Default Customize document content based on Mail Merge source fields?

I need help thinking through the best solution for some letters I need to create/mail merge. I'm comfortable with mail merge, and from poking around the forum this morning I think using an IF statement or something similar is possible, but that's not something I've done before and I'm not sure it's the solution to my problem.




I need to create letters to mail to individuals who are signed up to work various positions at various sites, and who will complete training on different days at different locations. The various positions and sites have different content (e.g., position description, directions to access a building, etc.). Instead of creating a multitude of base letters for these various situations, I'd like to automate this process (using mail merge?)


So, something like if John's position field is "computer" the letter includes the 3 sentence description of that position. And if his work site is "library" it includes location details and a specific schedule of days and times (in a table if that will work, but I can reformat that if needed). And then if his training field is Oct 3, content about that training day is inserted. And then, of course, John's name and address for mailing.


Even if you have general ideas about an approach, I can do some research on exactly how to execute this. I just figure there has to be a better way than creating a million different versions and only being able to mail merge the address block, but I'm not sure where to start.
Reply With Quote
  #2  
Old 09-20-2020, 08:29 PM
gmayor's Avatar
gmayor gmayor is offline Customize document content based on Mail Merge source fields? Windows 10 Customize document content based on Mail Merge source fields? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Given the amount of text to insert and the possible numbers of options, I would suggest creating autotext entries with names that match exactly the values in the field names in question then insert autotext fields in your document e.g. { AUTOTEXT { MERGEFIELD Position } } and { AUTOTEXT { MERGEFIELD Site } } etc
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 09-21-2020, 12:38 PM
mallorious mallorious is offline Customize document content based on Mail Merge source fields? Windows 10 Customize document content based on Mail Merge source fields? Office 2019
Novice
Customize document content based on Mail Merge source fields?
 
Join Date: Sep 2020
Posts: 2
mallorious is on a distinguished road
Default

Thank you!

I've never used autotext fields before, so I'm not sure I'm connecting all of the dots correctly.

If one of the sites is "Library," I think what I would end up with after merging is something like

{ Library}

Is that right? How do I get that to be replaced with the content of that autotext entry?

I've tried Googling this for an hour or two but I'm not figuring it out.
Reply With Quote
  #4  
Old 09-21-2020, 04:40 PM
Charles Kenyon Charles Kenyon is offline Customize document content based on Mail Merge source fields? Windows 10 Customize document content based on Mail Merge source fields? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,082
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

AutoText and other Building Blocks get stored in templates. During a merge an AutoText entry named "MyEntry1" will get inserted if you have the text "myentry1" in a record with the fieldname ATname and bring it in through a merge.
{ AutoText { MergeField ATname } }.


Such fields cannot be automatically created. You will need to do it by hand.
Using Fields in Microsoft Word
Ctrl+F9 creates a pair of the special field brace characters { }. You cannot just type them.
Reply With Quote
  #5  
Old 09-22-2020, 12:19 AM
gmayor's Avatar
gmayor gmayor is offline Customize document content based on Mail Merge source fields? Windows 10 Customize document content based on Mail Merge source fields? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Quote:
Originally Posted by mallorious View Post
Thank you!
I've never used autotext fields before, so I'm not sure I'm connecting all of the dots correctly.
If one of the sites is "Library," I think what I would end up with after merging is something like
{ Library}
Is that right? How do I get that to be replaced with the content of that autotext entry?.
If the site mergefield is called 'Site' and you have an autotext entry called 'Library' then
{ AUTOTEXT { MERGEFIELD Site } }
will insert the autotext 'Library' entry when Library is the value in that field in the record merged. The field is an Autotext field and the mergefield provides the value for the autotext field.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 09-22-2020, 03:04 PM
macropod's Avatar
macropod macropod is offline Customize document content based on Mail Merge source fields? Windows 7 64bit Customize document content based on Mail Merge source fields? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The simplest solution might be to create a single document that contains all the letter variants (or, at least the content that differs), with each variant given a unique bookmark name - preferably a name that matches the output from a field in the datasource that is used to discriminate between the letters, then use an INCLUDETEXT field in the mailmerge main document with a suitable MEREGEFILED in the bookmark reference position. For example:
Code:
{QUOTE{INCLUDETEXT "{FILENAME \p}/../Variations Document.docx" "{MERGEFIELD Variant}"}}
With the above construction, the document containing the variants would be named 'Variations Document' and stored in the same folder as the mailmerge main document. That document can even contain its own mergefields, if needs be. The {MERGEFIELD Variant} field would simply tell the INCLUDETEXT field which bookmark to look at, according to whatever;s stored in a data field named 'Variant' in the data source.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Customize document content based on Mail Merge source fields? Mail merge all fields into 1 document with rules MP1989 Mail Merge 6 06-27-2018 04:43 PM
Customize document content based on Mail Merge source fields? Mail Merge Using Rules "IF" to add additional Text Based On Merge Field Content Alfred Mail Merge 2 05-23-2017 10:59 PM
Using 3 different fields, several times in same document but not en mass - should I use mail merge? shoughton Mail Merge 1 06-24-2015 02:46 PM
Merge fields in Word and source data from Excel SteveVai Mail Merge 3 03-13-2014 05:25 AM
dynamic charts based on mail merge fields jwajehee Mail Merge 0 10-05-2011 09:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:18 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