E
ent
Doug said:You must use code (vba) to assign a value to the variable and you may
need to update the field so that the value assigned to the variable is
displayed.
What am I doing wrong:
1: I created a macro associated to the CTRL-K keyboard sequence.
The macro is Macro11 and it reads like this:
Sub Macro11()
'
' Macro11 Macro
'
Dim varYELLOW As String
varYELLOW = "Tom"
ActiveDocument.Variables.Add Name:="docvarONE", Value:=varYELLOW
'
End Sub
2: I insert a DocVariable in my document, it reads, in the document:
<brace>DOCVARIABLE docvarONE \* MERGEFORMAT<brace>
3: I press CTRL-K
I get RUNTIME ERROR 5903 THE VARIABLE NAME ALREADY EXISTS.
the string "Tom" never appeared in my document and if i go Print Preview
I get: ERROR! NO DOCUMENT VARIABLE SUPPLIED where the docVariable field is.
What am I doing wrong?