View Single Post
 
Old 07-07-2011, 11:28 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi Richard,

In this case, you can employ a database field, where you:
• use your Excel worksheet as the data source for the merge; and
• insert a DATABASE field into the mailmerge main document to select the records for each individual’s letter.
For example, if your workbook is called ‘c:\mywbs\teams.xlsx’ and the sheet is called Sheet1, the following nested field codes, which includes the database query, should result in a one-column table with the name of each participant in the group, other than the individual to whom the letter is addressed:
{DATABASE \d "C:\\a\\mywbs\\teams.xlsx" \s "SELECT [firstname] & ' ' & [surname] FROM [Sheet1$] WHERE [ID] <> {MERGEFIELD ID}"}
You can apply the DATABASE field formatting switches to get a suitable table format.

Note 1: the above assumes your records have both a 'firstname' field and a 'surname' field.

Note 2: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote