In this article bellow, we would like to introduce you the way to batch add or delete multiple autocorrect entries in your Word.
In Word, there is a built-in feature called autocorrect. Many users are already familiar with it. As a matter of fact, many of us use it to correct easily misspelled words. Although you can import as many items as you need, you have to do it one by one. Generally, we will have to put up with it. But, as far as macro is concerned, you will be able to save much time by creating a list of autocorrect entries and import them once for all in a click.
Following are details showing you how to accomplish it:
Batch Add Multiple AutoCorrect Entries
- First and foremost, open a blank document in Word and insert a table of 2 columns and multiple rows.
- In the table, enter all misspelled words in the first column.
- And enter all correct words in the second column.
- After it, press “Alt+ F11” to invoke the VBA editor in Word.
- Then click “Normal” and “Insert” tab.
- And choose “Module” on the drop-down menu.
- Next double click as to open the new module on the right-hand.
- Now paste the following codes there:
Sub BatchAddAutoCorrectEntries() Dim objTable As Table Dim objOriginalWord As Cell Dim objOriginalWordRange As Range Dim objReplaceWordRange As Range Dim nRowNumber As Integer Set objTable = ActiveDocument.Tables(1) nRowNumber = 1 For Each objOriginalWord In objTable.Columns(1).Cells Set objOriginalWordRange = objOriginalWord.Range objOriginalWordRange.MoveEnd Unit:=wdCharacter, Count:=-1 Set objReplaceWordRange = objTable.Cell(nRowNumber, 2).Range objReplaceWordRange.MoveEnd Unit:=wdCharacter, Count:=-1 AutoCorrect.Entries.Add Name:=objOriginalWordRange.Text, Value:=objReplaceWordRange.Text nRowNumber = nRowNumber + 1 Next objOriginalWord Msgbox("All autocorrect items in the table1 are added.") End Sub
- Last but not the least, click “Run” or hit “F5” to run the macro.
Notes:
- Running the macro will prompt a result box, indicating all items in the table are imported.
- Ensure there is no trailing space following the item in table cell. Otherwise, the macro shall fail.
Batch Delete Multiple AutoCorrect Entries
Here is the opposite need to batch delete multiple autocorrect entries in seconds. Luckily, with a macro, this should be easy.
- Firstly, create a new blank document in Word similarly.
- Then insert a table in 1 column of multiple rows.
- Enter all misspelled words you need to remove in the table.
- Next install and run a macro following the exact steps above.
- But replace the macro with this one:
Sub BatchDeleteAutoCorrectEntries() Dim objTable As Table Dim objOriginalWord As Cell Dim objOriginalWordRange As Range Dim nRowNumber As Integer Set objTable = ActiveDocument.Tables(1) nRowNumber = 1 For Each objOriginalWord In objTable.Columns(1).Cells Set objOriginalWordRange = objOriginalWord.Range objOriginalWordRange.MoveEnd Unit:=wdCharacter, Count:=-1 On Error Resume Next AutoCorrect.Entries.Item(objOriginalWordRange.Text).Delete nRowNumber = nRowNumber + 1 Next objOriginalWord Msgbox("All autocorrect items in the table1 are deleted.") End Sub
- Likewise, there is the result box as bellow:
Weapon to Fight with Document Corruption
Just imagine you have been working on a report for the whole day. And all of a sudden, Word stops responding. Then seconds later, you can find your report nowhere on computer. It seems they just vanished! How desperate you must feel! Yet, instead of crossing heart and praying for good luck, you need a real weapon to recover docx.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted xls and pdf repair software products. For more information visit www.datanumen.com
Leave a Reply