AutoCorrect 属性

       

返回一个 AutoCorrect 对象,该对象包含当前“自动更正”的选项、词条和例外项。只读。

示例

本示例添加一个“自动更正”替换词条。运行此代码后,在文档中键入的所有“sr”都会自动替换为“Stella Richards”。

AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards"

本示例将删除指定的原有“自动更正”词条。

Dim strInput as String
Dim aceLoop as AutoCorrectEntry
Dim blnMatch as Boolean
Dim intConfirm as Integer

blnMatch = False

strInput = InputBox("Enter the AutoCorrect entry to delete.")

For Each aceLoop in AutoCorrect.Entries
    With aceLoop
        If .Name = strInput Then
            blnMatch = True
            intConfirm = _
                MsgBox("Are you sure you want to delete " & _
                .Name, 4)
            If intConfirm = vbYes Then
                .Delete
            End If
        End If
    End With
Next aceLoop

If blnMatch <> True Then
    MsgBox "There was no AutoCorrect entry: " & strInput
End If