Page 1 of 11 123 ... LastLast
Results 1 to 15 of 156
  1. #1
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Catalog Mailmerge Tutorial Discussions

    This thread has been closed. Please start any new discussions in a new thread.
    Last edited by macropod; 2013-05-23 at 12:10. Reason: Thread closure
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  2. #2
    New Lounger
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi macropod,

    Thank you very much for the tutorial. I am impressed.

    I have a question for you though.

    I have an Excel file with data in three columns: Users, Dates, and Transactions.

    I have been asked to feed this data into a report in Word. So far, so good.

    The user name should be the primary key, and should appear in the top left corner of the page, then indented from the user name should be the dates, going down a column, and indented from the date should be the transactions, also going down in a column.

    The user name should appear only once, irrespective of how many dates there are, and a date should only appear once in the "date" column, irrespective of how many transaction the user did on that particular date.

    I am playing around with the code in the tutorial, but I just can not get it right. Any idea one how to get around this one?

    Thank you very much in advance.

    Shinano

  3. #3
    New Lounger
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi again,

    I got it. I figured it out, and thought I would share the result with the rest of you.

    {QOUTE{IF{MERGESEQ}= 1 "{SET Key1 ""}{SET Key2 ""{SET Key3""}"}"{IF{MERGEFIELD Team}<>{Key1} "{IF{MERGESEQ}> 1 "[hard page break]
    "}{MERGEFIELD State}{SET Key1 {MERGEFIELD Team}}hard page break
    " }{IF{MERGEFIELD Employee}<>{Key2} "hard page break
    {MERGEFIELD Employee}{SET Key2 {MERGEFIELD Employee}}" ""}tab{IF{MERGEFIELD Date}<> {Key3} "{MERGEFIELD Date}{SET Key3 {MERGEFIELD Date}}" ""}{MERGEFIELD Transation}hard page break
    "}

    -Sorry about the bold faced remarks. I had no idea on how to display a hard page break and a tab here on this page. Please replace them with the relevant keystrokes in Word.

    -Hope it may serve a purpose.

    Again, thanks to macropod for the inspiration.

    Shinano

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    I got it. I figured it out, and thought I would share the result with the rest of you.
    ....
    -Sorry about the bold faced remarks. I had no idea on how to display a hard page break and a tab here on this page. Please replace them with the relevant keystrokes in Word.
    Hi Shinano,

    I'm confused - I can't see why you need 3 keys. You previously said:
    The user name should appear only once, irrespective of how many dates there are, and a date should only appear once in the "date" column, irrespective of how many transaction the user did on that particular date.
    If I understand this correctly, all transactions are to appear, sorted by date for each user. In that case, you should be able to use the code under the heading 'Merge Records by Category Using Two Keys'. All you might need to do is to edit out the coding for the ditto marks, change the formatting to suit your needs and insert the code for a hard page break.

    Your field coding suggests you're also categorising by State, but there's no mention of a State field in your posts. It also appears you've nested your 'SET Key3' field inside the 'SET Key2' field, but maybe that's just a typo in the post.

    As for inserting the tabs and hard page breaks, you can insert them explicitly in the code as you've done, or via fields coded as {QUOTE 09} and {QUOTE 12}, respectively.
    Last edited by macropod; 2013-02-21 at 05:51.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Macropod,
    I have trouble to understand your field codes.
    {Quote{If{MergeSeq}=1}{SET Key ""}}"If{MergeField State}<>{Key} "{If{MERGESEQ}>1 {QUOTE 12}}{MergeField State}{Set Key {MergeField State}}<line feed><line feed>"}{MergeField City}<tab>{MergeField Representative}<tab>{Mergefield Sales}<line feed>"}<Paragraph>

    I don't understanding the meaning of:
    {If{MergeSeq}>1 {QUOTE 12}}{MergeField State}{Set Key {MergeField State}}<line feed><line feed>"}
    After the first record, would always the MergeSeq be set to greater than 1?


    {MergeField City}<tab>{MergeField Representative}<tab>{Mergefield Sales}<line feed>
    Regardless whether MergeSeq is equal to or greater than 1, the City, Representative, and Sales are always printed out? Isn't it?

    Thanks for your help in advance.

    Armstrong

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Hi armsys,

    Welcome to the Lounge!

    MERGESEQ is the sequence number of the merged record: 1 for the first record, 2 for the second record, etc. The part {If{MERGESEQ}>1 {QUOTE 12}} inserts a manual page break (ASCII character 12) only if you're not on the first record of the merge - you don't want to insert a page break before the first record!

    In this example, the merge field State is only displayed when State changes compared to the previous record. The merge fields City, Representative and Sales are displayed for every record.
    Last edited by macropod; 2013-02-21 at 05:52.

  7. #7
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Han,
    Thanks a lot for adding a lot of clarity. Now it makes a lot of sense. Compared with Macro, field codes lack the readability. Both brackets and quotation marks are hard to trace.
    Thanks.
    Armstrong

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Compared with Macro, field codes lack the readability.
    That's true, especially in complicated applicaitons of fields, such as those described by macropod. But they can be very useful - in some situations you can't rely on macros because users or their IT department may disable them. Fields will still work in such circumstances.
    Last edited by macropod; 2013-02-21 at 05:52.

  9. #9
    New Lounger
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Paul,

    I'm using your tutorial, but my Word 2007 add a section break after each item list.

    What's wrong?

    Thanks.

  10. #10
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    I'm using your tutorial, but my Word 2007 add a section break after each item list.

    What's wrong?
    Hi claubercy,

    Welcome to the lounge.

    I suspect you are using a normal 'letter' merge, not a Directory or Catalog merge. Please re-read the instructions under 'Set Up the Main Mailmerge Document'.
    Last edited by macropod; 2013-02-21 at 05:53.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  11. #11
    New Lounger
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello! I know there's a really simple answer but after 3 hours of trying I'm running out of juice....

    I understand the coding and I'm re-entering it in my own merged doc BUT I can't seem to insert the bookmark field "{key}" in the line that compares the new line...

    {if {MERGEFIELD City}<>{Key}

    I mean... you can't just type " {Key} " right? and I can't find it in the 'Insert Merge Field', 'insert Word Field' or bookmarks menus...

    Help will be gratefully received (as well as prevent me from going crazy! )

    Cheers... Mike

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Welcome to the Lounge!

    You are correct that you should not type {Key} just like that. You can insert the field like this:
    - Press Ctrl+F9 to insert the field braces { }
    - Type the word Key between the braces.

    In this situation, you'll already be displaying field codes, and you'll hide them later on.

    In a situation where you aren't displaying field codes, Ctrl+F9 will display the field code for the field you're inserting only. After typing the text you need, press F9 to hide the field code and to update its value.
    So for example, if you want to insert an automatically updating date field:
    - Press Ctrl+F9.
    - Type the word Date between the braces.
    - Press F9.

  13. #13
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    I understand the coding and I'm re-entering it in my own merged doc BUT I can't seem to insert the bookmark field "{key}" in the line that compares the new line...

    {if {MERGEFIELD City}<>{Key}

    I mean... you can't just type " {Key} " right? and I can't find it in the 'Insert Merge Field', 'insert Word Field' or bookmarks menus...
    Hi Mike,

    Welcome to the Lounge.

    All the fields a created via either the field selections offered by Word, or by pressing Ctl-F9 to create the field braces (ie '{}') and typing whatever is required between them.

    Another approach would be to copy & paste the fields coding from the tutorial into your own mailmerge main document, then modify the mergefield names to suit your needs, including adding/deleting mergefields as needed.
    Last edited by macropod; 2013-02-21 at 23:39.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  14. #14
    New Lounger
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Great - thanks Hans!!!

    It took me a couple more hours to get right but it's working well now

    Now I've got to figure out the formatting lol

    Thanks so much for your help - cheers Mike

  15. #15
    New Lounger
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    I am fairly new to mail merges and field codes (basically, I can follow the Mail Merge wizard but not much more). I think I understand in concept how your example works, but I can't seem to get it to work when I create a new document in Word 2003. When I toggle the field codes in order to evaluate the code in your example, all I get to display is:

    Code:
    				Yang		   2100
    I entered the code manually into a blank document - mostly to get used to entering field codes - which looked like this when entered (all written on one line):

    Code:
    {QUOTE{IF{MERGESEQ}= 1 {SET Key ""}}"{IF{MERGEFIELD City}<> {Key} "{IF{MERGESEQ}> 1 ""}{MERGEFIELD State}				{MERGEFIELD City}{SET Key {MERGEFIELD City}}"}		  {MERGEFIELD Representative}				{MERGEFIELD Sales}"}
    I made sure to use Ctrl+F9 to enter the fields, so what am I doing wrong? Do these have to evaluate one at a time rather than all at once? Are there hard breaks in the code that I'm missing?

    I hope that once I get this much figured out, your examples fit right in with what I'm trying to accomplish.

    Thanks!

Page 1 of 11 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •