AutoCorrect feature is used to correct typos and misspelled words (dont to don’t), as well as to insert symbols ((c) as ©) and other pieces of text. AutoCorrect is set up by default with a list of typical misspellings and symbols. If you want to add more entries, you can do that by following
Office Button - -> Word Options - -> Proofing Tab - - >Autocorrect Options
Add the mistyped word and the replacement in Replace Box -- >Add
Barak Obama is the democratic presidential candidate will become Barack Obama is the democratic presidential candidate once you type.
The same can be achieved through Word VBA / Excel VBA
Excel VBA Code:
Sub Add_AutoCorrect_Entry_XL()
On Error GoTo Err_Label
' ---------------------------------------------
' Coded by Shasur for www.vbadud.blogspot.com
' ---------------------------------------------
Application.AutoCorrect.AddReplacement "VBADUD Plc", "VBADUD Inc"
Application.AutoCorrect.AddReplacement "Barak Obama", "Barack Obama"
Err_Label:
If Err <> 0 Then
MsgBox(Err.Description)
Err.Clear
End If
End Sub
Word VBA Code:
Sub Add_AutoCorrect_Entry()
On Error GoTo Err_Label
' ---------------------------------------------
' Coded by Shasur for www.vbadud.blogspot.com
' ---------------------------------------------
Application.AutoCorrect.Entries.Add "VBADUD Plc", "VBADUD Inc"
Application.AutoCorrect.Entries.Add "Barak Obama", "Barack Obama"
Err_Label:
If Err <> 0 Then
MsgBox(Err.Description)
Err.Clear
End If
End Sub
Hi Shasur,
ReplyDeleteGreat stuff here thanks a mill for the info. I was wondering if you could help me. I want to write a similar code but using images as the autocorrection. If the word typed is at the beginning of a sentance =pdf 'a'. If it's not at the beginning = pdf 'b'.
What would I need to read up on to write this kind of code. I'm totally new to VBA.