Syntax
EditAutoText .Name = text [, .Context = number] [, .InsertAs = number] [, .Insert] [, .Add] [, .Delete]
Remarks
Inserts, adds, or deletes an AutoText entry. The arguments for the EditAutoText statement correspond to the options in the AutoText dialog box (Edit menu).
Argument | Explanation | |
.Name | The name of the AutoText entry. | |
.Context | A context for the new AutoText entry: 0 (zero) or omitted Normal template 1 Active template Note that .Context is used only when Word adds an AutoText entry. When inserting or deleting an entry, Word automatically looks for the entry first in the active template and then in the Normal template. When inserting an entry and no match is found in the active or Normal templates, Word looks in each loaded global template in the order listed in the Templates And Add-ins dialog box (File menu). You cannot delete an AutoText entry from a loaded global template. | |
.InsertAs | Used with .Insert to control whether the entry is inserted with its formatting: 0 (zero) or omitted Entry is inserted with formatting. 1 Entry is inserted as plain text. |
You can specify only one of the following arguments.
Argument | Explanation | |
.Insert | Inserts the entry into the document | |
.Add | Stores the entry in the template (if there is no selection, an error occurs) | |
.Delete | Deletes the entry from the template |
If you do not specify .Insert, .Add, or .Delete, Word inserts the AutoText entry.
Examples
This example selects the text of the first paragraph (not including the paragraph mark) and then defines it as an AutoText entry named "MainHead," stored in the Normal template:
StartOfDocument EditGoTo "\Para" CharLeft 1, 1 EditAutoText .Name = "MainHead", .Context = 0, .Add
The following example inserts the "MainHead" AutoText entry without formatting:
EditAutoText .Name = "MainHead", .InsertAs = 1, .Insert
See Also
AutoText, AutoTextName$(), CountAutoTextEntries(), GetAutoText$(), InsertAutoText, SetAutoText