Apply Method

Microsoft Word Visual Basic

Show All

Apply Method

       

Apply method as it applies to the AutoCorrectEntry object.

Replaces a range with the value of the specified AutoCorrect entry.

expression.Apply(Range)

expression   Required. An expression that returns an AutoCorrectEntry object.

Range  Required Range object.

Apply method as it applies to the Shape or ShapeRange object.

Applies to the specified shape formatting that has been copied using the PickUp method.

expression.Apply

expression   Required. An expression that returns one of the above objects.

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.

Example

As it applies to the AutoCorrectEntry object.

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)

As it applies to the Shape object.

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