Field codes: DocVariable field

The DocVariable field code inserts the string assigned to a document variable (variable: A named storage location capable of containing data that can be modified during program execution. Each variable has a name that uniquely identifies it within its level of scope. A data type can be specified or not.). Each document has a collection of variables, which can be added and referenced by the Microsoft Visual Basic for Applications (Visual Basic for Applications (VBA): A macro-language version of Microsoft Visual Basic that is used to program Windows applications and is included with several Microsoft applications.) programming language. This field provides a way to display the contents of the document variables in the document.

 Note   For more information about document variables, search for the Variables property in Visual Basic for Applications Help. If Help is not installed, run Setup again to install it.

Syntax

When you view the DocVariable field code in your document, the syntax looks like this:

{ DOCVARIABLE "Name" }

 Note    A field code tells the field what to show. Field results are what is shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.

Instructions

"Name"

The name of the document variable

 
 
Applies to:
Word 2013, Word 2010, Word 2007, Word 2003