This example adds a document variable to the active document and then displays the value of the new variable.
ActiveDocument.Variables.Add Name:="Temp2", Value:="10"
MsgBox ActiveDocument.Variables("Temp2").Value
This example displays the contents of the active data record in the data source attached to Main.doc.
For Each dataF In _
Documents("Main.doc").MailMerge.DataSource.DataFields
If dataF.Value <> "" Then dRecord = dRecord & _
dataF.Value & vbCr
Next dataF
MsgBox dRecord
This example creates an AutoCorrect entry and then displays the value of the new entry.
AutoCorrect.Entries.Add Name:="i.e.", Value:="that is"
MsgBox AutoCorrect.Entries("i.e.").Value
This example checks the grammar in the active document and then displays the Flesch reading-ease index.
ActiveDocument.CheckGrammar
MsgBox ActiveDocument.ReadabilityStatistics( _
"Flesch Reading Ease").Value