Class AutoCorrect (Excel VBA)

Contains Microsoft Excel AutoCorrect attributes (capitalization of names of days, correction of two initial capital letters, automatic correction list, and so on).

The main procedure of class AutoCorrect is AddReplacement

Methods

This is the main method of the AutoCorrect class

AddReplacement - Adds an entry to the array of AutoCorrect replacements.

With Application.AutoCorrect 
 .AddReplacement "Temperature", "Temp." 
End With

Properties

AutoExpandListRange a Boolean value indicating whether automatic expansion is enabled for lists. When you type in a cell of an empty row or column next to a list, the list will expand to include that row or column if automatic expansion is enabled.

Sub SetAutoExpand 
 
 Application.AutoCorrect.AutoExpandListRange = TRUE 
 
End Sub

AutoFillFormulasInLists affects the creation of calculated columns created by automatic fill-down lists.

CapitalizeNamesOfDays true if the first letter of day names is capitalized automatically.

With Application.AutoCorrect 
 .CapitalizeNamesOfDays = True 
 .ReplaceText = True 
End With

CorrectCapsLock true if Microsoft Excel automatically corrects accidental use of the CapsLock key.

Application.AutoCorrect.CorrectCapsLock = True

CorrectSentenceCap true if Microsoft Excel automatically corrects sentence (first word) capitalization.

Application.AutoCorrect.CorrectSentenceCap = True

DisplayAutoCorrectOptions allows the user to display or hide the AutoCorrect Options button. The default value is True.

Sub CheckDisplaySetting() 
 
 'Determine setting and notify user. 
 If Application.AutoCorrect.DisplayAutoCorrectOptions = True Then 
 MsgBox "The AutoCorrect Options button can be displayed." 
 Else 
 MsgBox "The AutoCorrect Options button cannot be displayed." 
 End If 
 
End Sub

Parent returns the parent object for the specified object. Read-only.

ReplacementList returns the array of AutoCorrect replacements.

repl = Application.AutoCorrect.ReplacementList 
For x = 1 To UBound(repl) 
 If repl(x, 1) = "Temperature" Then MsgBox repl(x, 2) 
Next

ReplaceText true if text in the list of AutoCorrect replacements is replaced automatically.

With Application.AutoCorrect 
 .CapitalizeNamesOfDays = True 
 .ReplaceText = False 
End With

TwoInitialCapitals true if words that begin with two capital letters are corrected automatically.

With Application.AutoCorrect 
 .TwoInitialCapitals = True 
 .ReplaceText = True 
End With