Toggling AutoCorrect Settings

Written by Allen Wyatt (last updated July 13, 2019)
This tip applies to Word 97, 2000, 2002, and 2003


2

Word includes a great feature that allows you to automatically streamline what you type. This feature, called AutoCorrect, automatically makes changes to what you type to fit specific rules that you select. For instance, you can cause Word to capitalize the first word of your sentences or automatically capitalize the names of days. (You can view your AutoCorrect settings by selecting AutoCorrect from the Tools menu.)

There are times when AutoCorrect can get in the way of what you are typing. This is particularly true if you are typing technical material. There is no "master switch" that allows you to turn off the AutoCorrect feature, however. Instead, you must display the dialog box and turn off each check box, in turn. When you later want it back on, you must go through the same process again.

The following macro can quickly turn off your AutoCorrect settings. When you run the macro a second time, the AutoCorrect settings are set back to their original values. The macro is designed to be added to a toolbar, and then you can click on the tool to change AutoCorrect.

Sub ToggleAC()
    Dim State As String
    Dim ACVal As Integer
    Dim VarPass As Variant
    Dim VarNum As Integer

    VarNum = 0
    For Each VarPass In ActiveDocument.Variables
        If VarPass.Name = "ACState" Then VarNum = VarPass.Index
    Next VarPass

    If VarNum <> 0 Then
        State = ActiveDocument.Variables.Item(VarNum).Value
        ACVal = Val(Mid$(State$, 1, 1))
        If ACVal <> 0 Then AutoCorrect.CorrectInitialCaps = True
        ACVal = Val(Mid$(State$, 2, 1))
        If ACVal <> 0 Then AutoCorrect.CorrectSentenceCaps = True
        ACVal = Val(Mid$(State$, 3, 1))
        If ACVal <> 0 Then AutoCorrect.CorrectDays = True
        ACVal = Val(Mid$(State$, 4, 1))
        If ACVal <> 0 Then AutoCorrect.CorrectCapsLock = True
        ACVal = Val(Mid$(State$, 5, 1))
        If ACVal <> 0 Then AutoCorrect.ReplaceText = True
        ACVal = Val(Mid$(State$, 6, 1))
        If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceQuotes = True
        ActiveDocument.Variables.Item(VarNum).Delete
    Else
        State = ""
        State = State & Mid(Str(Abs(AutoCorrect.CorrectInitialCaps)), 2)
        State = State & Mid(Str(Abs(AutoCorrect.CorrectSentenceCaps)), 2)
        State = State & Mid(Str(Abs(AutoCorrect.CorrectDays)), 2)
        State = State & Mid(Str(Abs(AutoCorrect.CorrectCapsLock)), 2)
        State = State & Mid(Str(Abs(AutoCorrect.ReplaceText)), 2)
        State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceQuotes)), 2)
        ActiveDocument.Variables.Add "ACState", State
        With AutoCorrect
            .CorrectInitialCaps = False
            .CorrectSentenceCaps = False
            .CorrectDays = False
            .CorrectCapsLock = False
            .ReplaceText = False
        End With
        Options.AutoFormatAsYouTypeReplaceQuotes = True
    End If
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1738) applies to Microsoft Word 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Removing Tabs Used to Indent a Paragraph

You get a document from a colleague and you notice that each paragraph starts with a tab character. Here are a couple of ...

Discover More

Updating a Field in a Text Box

If you put a field into a text box, you might be surprised to find that it doesn't update when you try to update all your ...

Discover More

Saving Search and Replace Information in a Macro

You may want to save a user's existing Find and Replace settings before changing them in your macro. This tip examines ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (menu)

Automatically Capitalizing Day Names

Type the name of any of the seven days into your document, and Word automatically makes sure it is capitalized. This is ...

Discover More

Make AutoCorrect Pay Attention to Character Case

If you rely on AutoText (as most Word users do), you may have noticed that it doesn't always give the desired results ...

Discover More

Enforcing a Do-Not-Use Word List

Got a list of words you don't want to appear in your documents? There are a number of ways that you can make sure they ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 0?

2023-11-19 13:02:31

Christina Howell

This really helped me a lot. Thank you! I use a program that runs into trouble when the autocorrect features are turned on. The engineers are taking a long time to fix this and I was not looking forward to turning the settings off and then remembering how I had them set before. I added code to change all the settings in the autocorrect module:

Sub ToggleAC()
Dim State As String
Dim ACVal As Integer
Dim VarPass As Variant
Dim VarNum As Integer

'Macro adapted from https://word.tips.net/T001738_Toggling_AutoCorrect_Settings.html
'modified to add extra autocorrect and autoformat options

VarNum = 0
For Each VarPass In ActiveDocument.Variables
If VarPass.Name = "ACState" Then VarNum = VarPass.Index
Next VarPass

If VarNum <> 0 Then
State = ActiveDocument.Variables.Item(VarNum).Value
ACVal = Val(Mid$(State$, 1, 1))
If ACVal <> 0 Then AutoCorrect.CorrectInitialCaps = True
ACVal = Val(Mid$(State$, 2, 1))
If ACVal <> 0 Then AutoCorrect.CorrectSentenceCaps = True
ACVal = Val(Mid$(State$, 3, 1))
If ACVal <> 0 Then AutoCorrect.CorrectDays = True
ACVal = Val(Mid$(State$, 4, 1))
If ACVal <> 0 Then AutoCorrect.CorrectCapsLock = True
ACVal = Val(Mid$(State$, 5, 1))
If ACVal <> 0 Then AutoCorrect.ReplaceText = True
ACVal = Val(Mid$(State$, 6, 1))

'I added these
If ACVal <> 0 Then AutoCorrect.ReplaceTextFromSpellingChecker = True
ACVal = Val(Mid$(State$, 7, 1))
If ACVal <> 0 Then AutoCorrect.CorrectKeyboardSetting = True
ACVal = Val(Mid$(State$, 8, 1))
If ACVal <> 0 Then AutoCorrect.DisplayAutoCorrectOptions = True
ACVal = Val(Mid$(State$, 9, 1))
If ACVal <> 0 Then AutoCorrect.CorrectTableCells = True
ACVal = Val(Mid$(State$, 10, 1))

If ACVal <> 0 Then Options.AutoFormatAsYouTypeApplyHeadings = True
ACVal = Val(Mid$(State$, 11, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeApplyBorders = True
ACVal = Val(Mid$(State$, 12, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeApplyBulletedLists = True
ACVal = Val(Mid$(State$, 13, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeApplyNumberedLists = True
ACVal = Val(Mid$(State$, 14, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeApplyTables = True
ACVal = Val(Mid$(State$, 15, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceQuotes = True
ACVal = Val(Mid$(State$, 16, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceSymbols = True
ACVal = Val(Mid$(State$, 17, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceOrdinals = True
ACVal = Val(Mid$(State$, 18, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceFractions = True
ACVal = Val(Mid$(State$, 19, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplacePlainTextEmphasis = True
ACVal = Val(Mid$(State$, 20, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeReplaceHyperlinks = True
ACVal = Val(Mid$(State$, 21, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeFormatListItemBeginning = True
ACVal = Val(Mid$(State$, 22, 1))
If ACVal <> 0 Then Options.AutoFormatAsYouTypeDefineStyles = True
ACVal = Val(Mid$(State$, 23, 1))
If ACVal <> 0 Then Options.TabIndentKey = True
ACVal = Val(Mid$(State$, 24, 1))

If ACVal <> 0 Then Options.AutoFormatApplyHeadings = True
ACVal = Val(Mid$(State$, 25, 1))
If ACVal <> 0 Then Options.AutoFormatApplyLists = True
ACVal = Val(Mid$(State$, 26, 1))
If ACVal <> 0 Then Options.AutoFormatApplyBulletedLists = True
ACVal = Val(Mid$(State$, 27, 1))
If ACVal <> 0 Then Options.AutoFormatApplyOtherParas = True
ACVal = Val(Mid$(State$, 28, 1))
If ACVal <> 0 Then Options.AutoFormatReplaceQuotes = True
ACVal = Val(Mid$(State$, 29, 1))
If ACVal <> 0 Then Options.AutoFormatReplaceSymbols = True
ACVal = Val(Mid$(State$, 30, 1))
If ACVal <> 0 Then Options.AutoFormatReplaceOrdinals = True
ACVal = Val(Mid$(State$, 31, 1))
If ACVal <> 0 Then Options.AutoFormatReplaceFractions = True
ACVal = Val(Mid$(State$, 32, 1))
If ACVal <> 0 Then Options.AutoFormatReplacePlainTextEmphasis = True
ACVal = Val(Mid$(State$, 33, 1))
If ACVal <> 0 Then Options.AutoFormatReplaceHyperlinks = True
ACVal = Val(Mid$(State$, 34, 1))
If ACVal <> 0 Then Options.AutoFormatPreserveStyles = True
ACVal = Val(Mid$(State$, 35, 1))
If ACVal <> 0 Then Options.AutoFormatPlainTextWordMail = True
ACVal = Val(Mid$(State$, 36, 1))
If ACVal <> 0 Then Options.LabelSmartTags = True
ACVal = Val(Mid$(State$, 37, 1))

If ACVal <> 0 Then Application.OMathAutoCorrect.UseOutsideOMath = True
ACVal = Val(Mid$(State$, 38, 1))
If ACVal <> 0 Then Application.OMathAutoCorrect.ReplaceText = True
ACVal = Val(Mid$(State$, 39, 1))

'end of added values here

ActiveDocument.Variables.Item(VarNum).Delete

MsgBox "Auto Correct Features Have Been Returned to Original Settings", vbExclamation
Else
State = ""
State = State & Mid(Str(Abs(AutoCorrect.CorrectInitialCaps)), 2)
State = State & Mid(Str(Abs(AutoCorrect.CorrectSentenceCaps)), 2)
State = State & Mid(Str(Abs(AutoCorrect.CorrectDays)), 2)
State = State & Mid(Str(Abs(AutoCorrect.CorrectCapsLock)), 2)
State = State & Mid(Str(Abs(AutoCorrect.ReplaceText)), 2)

'State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceQuotes)), 2) 'I commented this out as it was out of order
'I added from here
State = State & Mid(Str(Abs(AutoCorrect.ReplaceTextFromSpellingChecker)), 2)
State = State & Mid(Str(Abs(AutoCorrect.CorrectKeyboardSetting)), 2)
State = State & Mid(Str(Abs(AutoCorrect.DisplayAutoCorrectOptions)), 2)
State = State & Mid(Str(Abs(AutoCorrect.CorrectTableCells)), 2)

State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeApplyHeadings)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeApplyBorders)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeApplyBulletedLists)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeApplyNumberedLists)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeApplyTables)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceQuotes)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceSymbols)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceOrdinals)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceFractions)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplacePlainTextEmphasis)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeReplaceHyperlinks)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeFormatListItemBeginning)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatAsYouTypeDefineStyles)), 2)
State = State & Mid(Str(Abs(Options.TabIndentKey)), 2)

State = State & Mid(Str(Abs(Options.AutoFormatApplyHeadings)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatApplyLists)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatApplyBulletedLists)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatApplyOtherParas)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplaceQuotes)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplaceSymbols)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplaceOrdinals)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplaceFractions)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplacePlainTextEmphasis)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatReplaceHyperlinks)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatPreserveStyles)), 2)
State = State & Mid(Str(Abs(Options.AutoFormatPlainTextWordMail)), 2)
State = State & Mid(Str(Abs(Options.LabelSmartTags = False)), 2)

State = State & Mid(Str(Abs(Application.OMathAutoCorrect.UseOutsideOMath)), 2)
State = State & Mid(Str(Abs(Application.OMathAutoCorrect.ReplaceText)), 2)

'end of adding here


ActiveDocument.Variables.Add "ACState", State
With AutoCorrect
.CorrectInitialCaps = False
.CorrectSentenceCaps = False
.CorrectDays = False
.CorrectCapsLock = False
.ReplaceText = False ' I added from here
.ReplaceTextFromSpellingChecker = False 'these were not included in the original
.CorrectKeyboardSetting = False
.DisplayAutoCorrectOptions = False
.CorrectTableCells = False
End With

'I added these
With Options
.AutoFormatAsYouTypeApplyHeadings = False
.AutoFormatAsYouTypeApplyBorders = False
.AutoFormatAsYouTypeApplyBulletedLists = False
.AutoFormatAsYouTypeApplyNumberedLists = False
.AutoFormatAsYouTypeApplyTables = False
.AutoFormatAsYouTypeReplaceQuotes = False
.AutoFormatAsYouTypeReplaceSymbols = False
.AutoFormatAsYouTypeReplaceOrdinals = False
.AutoFormatAsYouTypeReplaceFractions = False
.AutoFormatAsYouTypeReplacePlainTextEmphasis = False
.AutoFormatAsYouTypeReplaceHyperlinks = False
.AutoFormatAsYouTypeFormatListItemBeginning = False
.AutoFormatAsYouTypeDefineStyles = False
.TabIndentKey = False
End With
With Options
.AutoFormatApplyHeadings = False
.AutoFormatApplyLists = False
.AutoFormatApplyBulletedLists = False
.AutoFormatApplyOtherParas = False
.AutoFormatReplaceQuotes = False
.AutoFormatReplaceSymbols = False
.AutoFormatReplaceOrdinals = False
.AutoFormatReplaceFractions = False
.AutoFormatReplacePlainTextEmphasis = False
.AutoFormatReplaceHyperlinks = False
.AutoFormatPreserveStyles = False
.AutoFormatPlainTextWordMail = False
End With
Options.LabelSmartTags = False

With Application.OMathAutoCorrect
.UseOutsideOMath = False
.ReplaceText = False
End With

MsgBox "Auto Correct Features Have Been Captured And Turned off", vbExclamation

'end of this addition

'Options.AutoFormatAsYouTypeReplaceQuotes = True I commented this out as it was included earlier

End If

End Sub


2021-06-10 06:16:30

Nick

Thanks A LOT[1]! They only I had to change was the 3rd line from the bottom to

Options.AutoFormatAsYouTypeReplaceQuotes = False #<--this was true

With false I also disable the automatic replacing of plain double quotes to nice looking double quotes.

[1] Being able to disable all these auto-correct/format niceties is very useful when I'm keeping notes about code. I could keep notes in a plain text editor but I would have to give away other extremely useful features like highlight a chunk with different color or bold characters.


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.