Docvariable with empty string value

921 Views Asked by At

In word, I'm using docvariables to manage pluralization. A VBA macro is changing the value of several docvariables to pluralize / singularize them.

But sometimes I want to use a Docvariable only for enable/disable a 's' suffix.

Problem: I cannot set it to empty string, because it deletes the docvariable. The field displays an error in word.

So I'm searching a way to achieve this, it could be :

  • A way to keep a Docvariable existing, with empty string or equivalent value
  • A field formula which make this job if the variable doesn't exist

Any other workaround would be appreciated.

Thank you

1

There are 1 best solutions below

0
On BEST ANSWER

A Document Variable (used in DocVariable field codes) cannot exist if it has no content.

A possibility would be to also store the space in this DocVariable so that it display s[space] or just [space].

Otherwise you may need to write this information to a Bookmark (possibly using a Set field) and display the content using a Ref field.