Word) (Application.AutoCorrect 属性

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

语法

expressionAutoCorrect

expression:表示 Application 对象的变量。

示例

本示例添加一个"自动更正"替换词条。 运行此代码后,在文档中键入的所有"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

另请参阅

Application 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。