• Word Directory Mailmerge – how can I use and increment a numeric variable in merge code?

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Word Directory Mailmerge – how can I use and increment a numeric variable in merge code?

    Author
    Topic
    #500830

    Hi, I have a Directory mail merge, ie. I have a spreadsheet of say 1000 records that gets printed on say 20 letters…each letter possessing a table with 50 records. I need to do something to manually split up my table at the 30th record within each letter so that it rolls to the 2nd page of the letter without issue. I initially thought I could use MERGESEQ, but this variable doesn’t reset letter from letter so I can’t use it directly. Can someone please help me understand how I can use QUOTE or SET or bookmarks or whatever to perhaps first set a variable = 1 at the start of the letter (when it recognizes a new key, different than the last record) and how to increment that variable by +1 for each subsequent record?

    THANKS!

    Tim

    Viewing 0 reply threads
    Author
    Replies
    • #1514319

      Without seeing what other field coding you’re using, it’s impossible to give specific advice. However, you will need to use a SET field to create a bookmark that can be used for a counter (e.g. {SET Counter = 0} or {SET Counter = 1}, depending on where you insert the field). Then, for each record, you’d increment the counter (e.g. {SET Counter = Counter +1}). Finally, to insert the page breaks, you’d use a field coded like {IF{=MOD(Counter,30) # 0}= 0 {QUOTE 12}} or {=MOD(Counter,30) # “;;'{QUOTE 12}'”} to generate the page break. If you’re grouping the records, you’d also need a field coded like {SET Counter = 0} or {SET Counter = 1} to reset the counter whenever the group changes.

      Cheers,
      Paul Edstein
      [Fmr MS MVP - Word]

    Viewing 0 reply threads
    Reply To: Word Directory Mailmerge – how can I use and increment a numeric variable in merge code?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: