ReplacementList Property

Applies To

AutoCorrect Object.

Description

Returns or sets the array of AutoCorrect replacements. This property is available only in Microsoft Excel for Windows 95. Read-write.

Syntax

object.ReplacementList(index)

object

Required. The AutoCorrect object.

index

Optional. Specifies which row of the array of AutoCorrect replacements to set or return. The row is returned as a one-dimensional array with two elements: the first element is the text in column 1, and the second element is the text in column 2. If index is out of range, the property fails.

If index is omitted, this property returns a two-dimensional array. Each row in the array contains one replacement, as shown in the following table.

Column

Contents

1

The text to replace

2

The replacement text


If index is omitted when you set this property, the entire replacement array is deleted and replaced.

Remarks

Be very careful when you set this property. If you don't specify the index argument, you'll delete the entire replacement array. It may be easier and safer to change a replacement by using the AddReplacement method.

Duplicate strings in column one of the array of replacements aren't allowed. If you attempt to modify or replace the array in a way that would create this condition, an error occurs.

See Also

AddReplacement Method, DeleteReplacement Method.

Example

This example searches the replacement list for "Temperature", sets the text to replace it with to "Temp.", and then writes the new array of AutoCorrect replacements to a worksheet.


With Application.AutoCorrect
    For x = 1 To UBound(.ReplacementList)
            repl = .ReplacementList(x)
            If repl(1) = "Temperature" Then
                repl(2) = "Temp."
                .ReplacementList(x) = repl
            End If
        Worksheets(1).Cells(x, 1) = repl(1)
        Worksheets(1).Cells(x, 2) = repl(2)
    Next
End With