Sub GetSetDocVars()
Dim fName As String
fName = "Jeff Smith"
' Set contents of variable "fName" in a document using a document
' variable called "FullName".
ActiveDocument.Variables.Add Name:="FullName", Value:=fName
' Retrieve the contents of the document variable.
MsgBox ActiveDocument.Variables("FullName".Value
End Sub
NOTE : The following error message appears if the Variable name is already set in the document:
Run-Time Error "5903": The Variable name already exists.
You must delete the name or just reset the value argument.
"Now I get variable already exists" I've seen people do this before but I've never seens the working code?