Illegal characters in Word mergefields RRS feed

  • Question

  • When attaching (say) an Excel worksheet to a Word merge document as its data source, Word treats some fieldname characters as illegal and strips them out or ignores them e.g. "/". Thus "Zip/PostCode" is treated at "ZipPostCode".

    Does anyone have, or can point to, a list of the characters that are handled in this way please?

    Graham Mayor - Word MVP
    Tuesday, November 15, 2011 3:19 PM

All replies

  • In a light test it seems most non alpa/numeric characters are not recognized. Try this

    In Excel,
    A1 ="A"& CHAR(COLUMN()+31)&"B"
    A2 =A1&"xx"
    Copy A1:A2 across to P1  (or grab to little handle and drag across)
    Fill A1:P16 with numbers 1 to 16

    Save and close the file as the mail merge source

    Open the Excel file in Word as the mail merge source
    Insert each of the fields

    For my second recipient (ie the numbers) instead of 1 to 16 this is what I got

    I didn't check all the other special characters, eg Chr 58-64, 91-96, 123-184

    Peter Thornton

    Tuesday, November 15, 2011 4:44 PM
  • Hmm, trying again they all seem to work after all, try this in Excel

    A5:P5, numbers 32 to 47
    A4 =CHAR(COLUMN()+64)
    A1 =A4& CHAR(A5)&A4
    A2 =A1&"xx"
    A3 =A5& ","

    copy A1:A4 across to P1:P4

    If I insert in mail merge everything arrives as expected, including "P/Pxx" and "47," for the 1st & 2nd recipients

    Not sure what was going on first time!

    Peter Thornton

    Tuesday, November 15, 2011 5:01 PM
  • Peter thanks - I had wrongly assumed that the characters would be similar to those that are illegal in filenames, but this notion was quickly dispelled. My own tests suggested that (with Word 2010 at least) that characters in the range

    34 – 47, 58 -64, 91 – 96, 123 and (probably) above are mainly replaced with nothing, though at least one of them was replaced with an underscore. I will conduct some more tests with dummy field names to try get the measure of it.

    Graham Mayor - Word MVP
    Wednesday, November 16, 2011 5:19 AM