Office Settings & Configuration

How to Set Word Default Shading and Table Borders with VBA

Elise WilliamsElise Williams Oct 26, 2026 868 views

Question details

The user wants to configure a default shading color (such as yellow) and set table border options using a VBA macro without immediately applying the formatting to a specific text selection.

How to Set Word Default Shading and Table Borders with VBA
Product
Microsoft Word
Device & OS
not provided
Scenario
Attempting to preset UI color preferences for paragraph shading and table borders using AutoExec or AutoNew VBA macros so the color is ready to use when needed.
Observed behavior
VBA formatting commands require a target range or selection. Running an AutoNew macro immediately applies the shading to the current paragraph rather than simply setting the tool's default color preference.
Before you start

Before diving into VBA macros, check if Word's built-in paragraph styles or table styles can achieve your formatting goals, as they are specifically designed for saving reusable formatting preferences.

Solution 1Recommended

Use Paragraph and Table Styles for Default Formatting

Since VBA requires a target selection to apply shading, setting up reusable Styles is the best way to keep specific shading and border formats ready to use without unwanted highlighting.

VBA commands for shading and borders apply formatting directly to a document object. You cannot simply set the UI's default color picker preference through VBA without formatting text. Using custom Styles avoids this limitation by saving your exact formatting preferences for quick application across any document.

1
Open the Styles Pane

Open your Word document, go to the Home tab, and click the Styles Pane launcher (the small arrow in the bottom-right corner of the Styles group).

2
Create a New Style

Click the 'New Style' button at the bottom of the pane. Give your style a descriptive name and set the Style type to either 'Paragraph' or 'Table'.

3
Configure Shading and Borders

Click the 'Format' button in the bottom left of the dialog, select 'Borders and Shading', and set your preferred yellow background or specific table borders.

4
Save to Template

Select the 'New documents based on this template' radio button if you want this style available in all future documents, then click OK to save.

Use Paragraph and Table Styles for Default Formatting
Best Practice: Using styles is much safer than running AutoNew macros, as it prevents new documents from automatically highlighting the very first empty paragraph you type.
Free Microsoft Office alternative

Try WPS Office for Seamless Document Formatting

If you are struggling with complex VBA macros and limitations just to set standard formatting in Microsoft Word, WPS Office offers a highly intuitive, user-friendly interface for managing paragraph and table styles. It is a powerful, lightweight alternative that simplifies formatting without requiring code.

  1. 1. Download WPS Office: Install WPS Office Free on your computer or mobile device.
  2. 2. Open Your Document: Open your existing Microsoft Word (.docx) documents directly in WPS Writer with full formatting preservation.
  3. 3. Apply Styles Easily: Use the built-in Styles panel to easily set, modify, and apply default shading and borders across your documents.
Free and lightweight alternative to Microsoft OfficeFully compatible with Microsoft Word (.docx) formats and templatesIntuitive Styles menu to easily manage default shading and bordersNo complex VBA coding required for everyday formatting tasks
microsoft office alternative - wps office

Frequently Asked Questions

Can I change the default shading color in Word without applying it?

No, Word requires an active selection or range to apply shading. You cannot change the default color of the shading tool in the ribbon using VBA without formatting a target in the document.

How do I make table borders apply by default in Word?

By default, new tables in Word are created with all borders applied. If you want to customize this default appearance, modify the 'Table Grid' or 'Normal Table' style in the Styles pane rather than using a VBA macro.

Why does my AutoNew macro highlight the first paragraph automatically?

An AutoNew macro runs immediately when a new document is created. If your macro contains formatting commands targeted at the 'Selection' object, it will automatically apply that formatting (like yellow shading) to wherever your cursor is located upon opening the file.