AutoTextEntries Property Example
This example deletes the AutoText entry named "Hello" if the entry exists in the attached template.
For Each entry In ActiveDocument.AttachedTemplate.AutoTextEntries
If entry.Name = "Hello" Then entry.Delete
Next entry
This example adds an AutoText entry named "Temp" to the Normal template. The contents of the AutoText entry (the first word in the document) are then displayed in a message box.
Set myEntry = NormalTemplate.AutoTextEntries.Add(Name:="Temp", _
Range:=ActiveDocument.Words(1))
MsgBox myEntry.Value
This example stores the contents of the selection as an AutoText entry named "Address" in the attached template.
If Len(Selection.Text) > 1 Then
ActiveDocument.AttachedTemplate.AutoTextEntries.Add _
Range:=Selection.Range, Name:="Address"
End If