Apply Method

Applies To

AutoCorrectEntry object, Shape object, ShapeRange collection object.

Description

AutoCorrectEntry object: Replaces a range with the value of the specified AutoCorrect entry.

Shape or ShapeRange object: Applies to the specified shape formatting that has been copied using the PickUp method.

Syntax 1

expression.Apply(Range)

Syntax 2

expression.Apply

expression Required. An expression that returns an AutoCorrectEntry object (Syntax 1) or a Shape or ShapeRange object (Syntax 2).

Range Required Range object. The Range that's replaced by the AutoCorrect entry.

Remarks

If formatting for the Shape or ShapeRange object has not previously been copied using the PickUp method, using the Apply method generates an error.

See Also

Add method (AutoCorrectEntries collection), AutoCorrect property.

Example

This example adds an AutoCorrect replacement entry, then applies the "sr" AutoCorrect entry to the selected text.

AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards"
AutoCorrect.Entries("sr").Apply Selection.Range
This example applies the "sr" AutoCorrect entry to the first word in the active document.

AutoCorrect.Entries("sr").Apply ActiveDocument.Words(1)
This example copies the formatting of shape one on the active document and applies the copied formatting to shape two on the same document.

With ActiveDocument
    .Shapes(1).PickUp
    .Shapes(2).Apply
End With