MS Word: Manipulating bookmark text values based on checkbox values

733 Views Asked by At

I could use some guidance on the following:

I am creating a Word form that generates barcodes with fieldcodes/bookmark text:

{DISPLAYBARCODE "{REF TXTUSN}" CODE128 \T \H 850 \R}

Basically I am creating a form with multiple options generate barcodes that contain the user's selections. The form then reaches some staff that transcribed it in the past. Now they just scan the barcode(s) and go on their merry way.

I have multiple checkbox formfields - hypothetically let us say the options are

  1. Male
  2. Female

And lets say that checkbox 1 has the bookmark name "checkMale" & checkbox 2 has bookmark name "checkFemale".

Now I would like for my DISPLAYBARCODE field to generate a barcode with the text value of "Male" or "Female" depending on the box checked.

My ability to manipulate these with VBA code is limited. If there is a way to do this without VBA please help me! If you believe VBA is the best option please set me on the right path. My google-fu has proved fruitless.

Thanks in advance,

J.

1

There are 1 best solutions below

0
On

You cannot test a checkbox formfield's status via field coding - a macro would be required. A non-macro solution would be to use a dropdown formfield, which also has the advantage that only one item can be chosen. If, for example, your dropdown has the options:

  • Choose
  • Male
  • Female

you might use a DISPLAYBARCODE field coded as:

{DISPLAYBARCODE "{REF Dropdown1}" CODE128 \T \H 850 \R}

or:

{IF{REF Dropdown1}<> "Choose" {DISPLAYBARCODE "{REF Dropdown1}" CODE128 \T \H 850 \R}}