One of the field codings that Emily Hua tried originates from this conversation:
However, the original (which I believe does what is necessary) is this:
{ IF "{ MERGEFIELD Ticket_Number }" = "" "{ SET tn " " }{ SET h 1 }" "{ SET tn { MERGEFIELD Ticket_Number } }{ SET h 1300 }" }{ DISPLAYBARCODE "{ tn }" CODE128 \t \h { h } }
There are two main differences:
- the original has { SET tn " " } (i.e. sets tn to a space) rather than { SET tn "" } . If you set tn to an empty string you just end up with the error message
- the original has { SET h 1 } rather than { SET h "" }. This is crucial because setting h sets the height of the image to 1 rather than 1300, and in fact that is what really makes this work.
This technique still inserts something rather than nothing, but I think it is the smallest something that can easily be achieved using field coding rather than post-merge edits.
As usual, all the {} pairs have to be the special field code brace pairs that you can typically insert on Windows desktop Word using ctrl-F9.
As mentioned in the Technet conversation, there is a sample document+data source:
'I have uploaded a simple example to https://1drv.ms/u/s!AgOi7jMKouNNnnQr4HdM1cq3VCcM . If you want to try it, you will need to...
- download the .zip file and unzip the two files into a folder. The mail merge main document is mmmd.docx and the data source document is mmds.docx
- open mmmd.docx and use the mailmerge tab to connect it to the data source
- preview the merge
- perform the merge to a new document. There are some deliberate problems in the data source and some coding that will deliberately fail in those cases, so you will see a few popups.
If you have the time to check that and it does not work on your system that would be useful to know (but of course, the problem then is "what's the difference?")'
This particular technique can't be used with MERGEBARCODE. Also, as far as I can tell, DISPLAYBARCODE and MERGEBARCODE are still not available on the Mac desktop version of Word.