Im working with docvariable fieldcodes.
Ive the following syntax
{ IF { DOCVARIABLE VarName } = "Number" "True" "False" }
however no matter how I set my docVariable its not displaying the results I want.
I want:
If {docVariable name = blank/empty "display nothing" "display the value"}
well ive actually done it the other way:
If {docVariable name <> blank/empty "display the value" "display nothing"}
my docVariable field code is:
{ if {DOCVARIABLE cms_contact_position } <> "" "{ DOCVARIABLE cms_contact_position \* charformat }" ""}
any ideas?
TIA, dd
Word 2007 - if DOCVARIABLE is blank
-
- Administrator
- Posts: 78463
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Word 2007 - if DOCVARIABLE is blank
A document variable cannot be blank. If you set the value of a document variable to "" in VBA, the document variable is removed.
The best you can do is set the value to a single space:
You can then use a field code like this in the document:
The best you can do is set the value to a single space:
Code: Select all
ActiveDocument.Variables("VarName") = " "
Code: Select all
{ IF { DOCVARIABLE "VarName" }=" " "" "{ DOCVARIABLE "VarName" }" }
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 279
- Joined: 01 Jun 2010, 00:27
Re: Word 2007 - if DOCVARIABLE is blank
Thanks Hans
yes I had a feeling there was a limitation with DocVariable = blank or ""
Many thanks again
dd
yes I had a feeling there was a limitation with DocVariable = blank or ""
Many thanks again
dd