Variable.Value Property

Word Developer Reference

Returns or sets the value of a document variable. Read/write String.

Syntax

expression.Value

expression   Required. A variable that represents a Variable object.

Remarks

Setting the Value property to a string longer than 255 characters generates an error.

Example

This example adds a document variable to the active document and then displays the value of the new variable.

Visual Basic for Applications
  ActiveDocument.Variables.Add Name:="Temp2", Value:="10"
MsgBox ActiveDocument.Variables("Temp2").Value

See Also