How to Disable AutoCorrect for a Specific Style in Word
Question details
The user wants to stop Word from automatically capitalizing the first letter of lines for custom styles like Code and Code Block, without disabling AutoCorrect globally.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Editing documents containing code snippets where automatic capitalization interferes with the exact syntax.
- Observed behavior
- Word automatically capitalizes the beginning of lines formatted with custom Code styles, and there is no built-in option to disable this behavior per-style.
Keep in mind that Microsoft Word applies AutoCorrect rules globally by default. If you frequently insert code blocks, consider setting up a quick toggle macro or adjusting global settings temporarily.
Temporarily Disable Automatic Capitalization
Since Word does not allow disabling AutoCorrect for a single style, the most straightforward workaround is to turn off the capitalization rule globally while typing code.
This method involves turning off the specific rule that causes the capitalization issue, allowing you to type your code blocks smoothly. You can easily turn it back on once you return to typing normal text.
Click on 'File' in the top ribbon and select 'Options' at the bottom of the menu.
In the Word Options dialog box, select 'Proofing' from the left-hand navigation pane.
Click on the 'AutoCorrect Options...' button located at the top of the right pane.
Under the 'AutoCorrect' tab, uncheck the box for 'Capitalize first letter of sentences' and click 'OK' to save your changes.

Create a Macro to Toggle AutoCorrect
If you frequently switch between writing regular text and code, you can use a VBA macro assigned to a keyboard shortcut to quickly toggle the capitalization setting.
Manage AutoCorrect Easily in WPS Writer
If you frequently work with code snippets and text, WPS Writer provides a streamlined interface to manage AutoCorrect rules. You can quickly adjust settings to ensure your code formatting remains exactly as typed without navigating complex menus.
- 1. Open Settings: Launch WPS Writer, click the 'Menu' button in the top left corner, and select 'Options'.
- 2. Access AutoCorrect: In the Options window, click on the 'Edit' tab and look for the 'AutoCorrect' section.
- 3. Adjust Capitalization: Uncheck the option that automatically capitalizes the first letter of sentences, then click 'OK' to apply your exact formatting.

Frequently Asked Questions
Can I link AutoCorrect to a specific font instead of a style?
No, AutoCorrect rules in Word act at the application level globally. They cannot be tied to specific fonts, paragraphs, or individual styles.
Why does Word capitalize the first letter of my code lines?
By default, Word considers any new line created by a paragraph break (Enter key) as the start of a new sentence, triggering the 'Capitalize first letter of sentences' AutoCorrect rule.
Can I undo an automatic capitalization without changing the settings?
Yes. Immediately after Word capitalizes a letter, press Ctrl+Z. This undoes the AutoCorrect action while keeping the text you typed exactly as you typed it.




