View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default add a random paragraph of text to each of my letters

It would be at best pseudo-random, but roughly speaking
a. let's suppose you had a document c:\mydoc.doc that contained 14
paragraphs, bookmarked "b0", "b2", "b3",..,"b14"
b. you use something like

{ IF TRUE "{ INCLUDETEXT "c:\\mydoc.doc" "b{ =mod(x, 15) })" }

to include one of those 15 paragraphs (where each pair of {} is a pair
of the special field code braces that ou can isert using ctrl-F9)

Then it's a question of what you can use to (pseudo-)randomise "x". I
suppose I would look for some combination of something in your data
(e.g. a record ID or some other arbitrary datum that you could convert
into a number, either in your data source or using field codes) and
something like a time field such as { TIME \@"ss" } to provide something
that would vary from run to run. Up to you.

With some types of data source, you might be able to return a random
number or pseudo-random number as a field in a query or view, and use
that to make a selection along the general lines I have suggested.

Peter Jamieson

http://tips.pjmsn.me.uk

On 22/03/2010 16:30, benrkay wrote:
Hi, im looking to add a random paragraph of text to each of my letters
in a mail merge. i.e. the first paragraph is one of about 15 different
sets of text that Is chosen at random. Is this possible. thanx