How to Create Keyboard Shortcuts for Shading Colors in Word
Question details
The user needs a method to assign custom keyboard shortcuts to instantly apply specific shading colors to text selections in Microsoft Word.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Editing and formatting documents where multiple distinct shading colors need to be applied frequently to highlight different types of information.
- Observed behavior
- Microsoft Word lacks native keyboard shortcuts to apply specific background shading colors directly, requiring users to navigate the ribbon menu manually.
Ensure the Developer tab is enabled in your Word ribbon, as you will need to paste a brief VBA macro code to create these custom color shortcuts.
Create VBA Macros and Assign Custom Keys
Use a simple VBA script to define your desired shading colors, then bind those scripts to custom key combinations like F2 or F3 via the Customize Ribbon settings.
By storing these custom macros in the Normal.dotm global template, your newly assigned shading shortcuts will remain available across all future Word documents.
Press Alt + F11 to launch the Visual Basic for Applications (VBA) editor in Microsoft Word.
In the Project Explorer pane on the left, right-click on 'Normal', navigate to 'Insert', and select 'Module'.
Type or paste your macro code into the module. For example: Sub ShadeRed() Selection.Shading.BackgroundPatternColor = wdColorRed End Sub Sub ShadeGreen() Selection.Shading.BackgroundPatternColor = wdColorGreen End Sub
Close the VBA editor. Back in Word, navigate to File > Options > Customize Ribbon, and click the 'Customize' button next to 'Keyboard shortcuts' at the bottom of the window.
In the 'Categories' list, scroll down and select 'Macros'. Select 'ShadeRed' from the Macros list on the right, click inside the 'Press new shortcut key' box, press your desired key (e.g., F2), and click 'Assign'. Repeat this process for your other color macros.

Apply Text Shading Quickly with WPS Office
WPS Office Writer offers an intuitive, streamlined interface for applying text shading and highlights effortlessly. It is fully compatible with Microsoft Word document formats, allowing for fast editing without requiring complex VBA setups.
- 1. Open your document in WPS Writer: Launch WPS Office and open your .doc or .docx document.
- 2. Select the target text: Highlight the text, paragraph, or table cell you wish to shade.
- 3. Apply Shading: Navigate to the Home tab and click the 'Character Shading' or 'Highlight' icon to instantly apply your selected color.
- 4. Use Format Painter: To apply the exact same shading color elsewhere efficiently, double-click the Format Painter tool and brush over other text blocks.

Frequently Asked Questions
Can I assign a keyboard shortcut to the standard highlight tool in Word without macros?
Yes, you can assign a shortcut to the general Highlight tool by navigating to Customize Keyboard > All Commands > Highlight. However, this will only trigger the currently selected highlight color in your ribbon, whereas VBA macros allow you to assign different dedicated keys to different specific colors simultaneously.
Why do my custom shortcut keys disappear when I restart Word?
This typically happens if your macro or keyboard shortcuts were saved to the current document instead of the global template. When assigning the shortcut, ensure the 'Save changes in' dropdown is set to 'Normal.dotm'. Also, make sure to accept any prompts to save the global template upon exiting Word.
What are the VBA color codes for other shading colors like blue or yellow?
In VBA, you can use built-in constants to specify colors. Some common constants include wdColorBlue, wdColorYellow, wdColorLightBlue, wdColorBrightGreen, or wdColorGray25. Simply replace 'wdColorRed' in your macro code with one of these standard Word color constants to achieve the desired shade.




