Selection.CreateAutoTextEntry Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.

expression .CreateAutoTextEntry(Name, StyleName)

expression Required. A variable that represents a Selection object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Required

String

The text the user must type to call the new AutoText entry.

StyleName

Required

String

The category in which the new AutoText entry will be listed on the AutoText menu.

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"
Show: