CreateAutoTextEntry 方法 (Word)Selection.CreateAutoTextEntry method (Word)

基于当前所选内容, 将新的**AutoTextEntry** 对象添加到**AutoTextEntries** 集合中。Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.

语法Syntax

expressionexpression. CreateAutoTextEntry( _Name_ , _StyleName_ )

expression:必需。expression Required. 表示 Selection 对象的变量。A variable that represents a Selection object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
NameName 必需Required StringString 该文本必须由用户键入,以调用新的“自动图文集”词条。The text the user must type to call the new AutoText entry.
StyleNameStyleName 必需Required StringString 新的 "自动图文集" 词条将在 "自动图文集" 菜单上列出的类别。The category in which the new AutoText entry will be listed on the AutoText menu.

示例Example

本示例在“Mailing Instructions”类别下,以“HAND DELIVERY”作为当前选定的文本创建一个新的名为“handdel”的“自动图文集”词条。This example creates a new AutoText entry named "handdel" under the category "Mailing Instructions," given "HAND DELIVERY" as the currently selected text.

Selection.CreateAutoTextEntry "handdel", _ 
 "Mailing Instructions"

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.