How to Batch Add or Delete Multiple AutoCorrect Entries in Your Word

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.Batch Add or Delete Multiple AutoCorrect Entries

Following are details showing you how to accomplish it:

Batch Add Multiple AutoCorrect Entries

  1. First and foremost, open a blank document in Word and insert a table of 2 columns and multiple rows.
  2. In the table, enter all misspelled words in the first column.
  3. And enter all correct words in the second column.Create a Table to Hold Both Misspelled and Correct Words
  4. After it, press “Alt+ F11” to invoke the VBA editor in Word.
  5. Then click “Normal” and “Insert” tab.
  6. And choose “Module” on the drop-down menu.Click "Normal"->Click "Insert"->Click "Module"
  7. Next double click as to open the new module on the right-hand.
  8. 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
  1. Last but not the least, click “Run” or hit “F5” to run the macro.Paste Codes->Click "Run"

Notes:

  1. Running the macro will prompt a result box, indicating all items in the table are imported.Result Box Indicating All Items are Imported
  2. 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.

  1. Firstly, create a new blank document in Word similarly.
  2. Then insert a table in 1 column of multiple rows.
  3. Enter all misspelled words you need to remove in the table.All Misspelled Words
  4. Next install and run a macro following the exact steps above.
  5. 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
  1. Likewise, there is the result box as bellow:Result Box

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

9 responses to “How to Batch Add or Delete Multiple AutoCorrect Entries in Your Word”

  1. I tried it and got an error. I managed to fix the error by changing the following line:

    “AutoCorrect.Entries.Add Name:=objOriginalWordRange.Text, Value:=objReplaceWordRange.Text”

    Just add “Application.” at the beginning so that it reads as follows:

    “Application.AutoCorrect.Entries.Add Name:=objOriginalWordRange.Text, Value:=objReplaceWordRange.Text”

  2. It is not working. It is giving an error message: Compile Error Expected Function as Variable
    It is showing the following line as the error

    Autocorrect.Entries.Add Name:=objOriginalWordRange.Text, Value:=objReplaceWordRange.Text
    Please guide how to rectify this error.

  3. Great stuff, thanks. Any way to do this in Excel? I don’t dabble in VBA much at all, and VBA in excel seems to be a little different- at least in 365. Would love your feedback.

  4. This works perfectly thank you but does not keep formatting (e.g. bold or italics). Is there a way to maintain the formatting when adding these?

Leave a Reply

Your email address will not be published. Required fields are marked *