Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2008
    Location
    Watford UK
    Posts
    104
    Thanks
    1
    Thanked 1 Time in 1 Post

    More conditional mail merge

    I'm trying to do a mail merge using an excel spreadsheet as the data.

    I'm trying to skip records based on date field. Trouble is I don't know the format of the data from excel. Being in the UK, the date format within Excel is dd/mm/yy. When I import the date into the mail merge it displays as mm/dd/yy. I've tried and it won't recognise either of those formats or the numerical value of the excel date.

    Can anyone help please

    David

  2. #2
    2 Star Lounger
    Join Date
    Jun 2008
    Location
    Watford UK
    Posts
    104
    Thanks
    1
    Thanked 1 Time in 1 Post
    I managed to solve this one myself.

    In the same way you can format mergefields with the @ key, you can get Word to recognise formatted data.

    adding \@"ddMMyy" to a date field will force Word to display the result for 29 May 2011 as 290511. Now if you want to skip any records not dated 29 May 2011 place the following rule at start of document:

    { SKIPIF {MERGEFIELD Date \@"ddMMyy" }<>290511}

    Curly brackets added with Ctrl+F9

    David

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Hi David,

    I'd suggest using a construct like:
    {SKIPIF{MERGEFIELD Date \@ YYYYMMDD}<> "20110529"}
    This provides greater flexibility, in that with a change to the operator, the the comparison allows you to skip records before or after a specified date. And, with the combination of two SKIPIF fields, to specify a date range.

    Note: it's not a good idea to have a data field named 'Date', because Word has a DATE field and there's a risk of confusion.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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