Document Editing Problems

Fix Microsoft Word Content Control Shading That Stays Yellow

Kushani NimanthikaKushani Nimanthika Nov 13, 2026 871 views

Question details

The user needs VBA-applied yellow shading to clear when a Word date-picker, plain-text, or drop-down content control is exited, even if its value has not changed.

Fix Microsoft Word Content Control Shading That Stays Yellow
Product
Microsoft Word with VBA content control event handlers
Device & OS
not provided
Scenario
A document uses VBA to highlight content controls while they are active and restore their background when the user leaves them.
Observed behavior
Yellow shading can remain after the user enters and immediately exits a content control without changing its value. This behavior was reported in Word 2013 and Word 2019.
Before you start

Open the affected document in desktop Word and enable macros only if you trust its source. Check the document's page color under Design > Page Color so the reset color matches the page background.

Solution 1Recommended

Set an explicit background color in the content control exit handler

Use this fix when the exit macro runs but wdColorAutomatic leaves the yellow shading visible.

The reported fix is to replace wdColorAutomatic with wdColorWhite in the shading-reset statement. For a nonwhite page, use the document's actual page color instead.

Keep the reset in the exit handler so it also runs when the user leaves a control without changing its value. Word has a built-in ContentControlOnExit event; an OnChange handler, if present, may be part of custom event code rather than a built-in Word content control event.

1
Open the VBA exit handler

In Word, open Developer > Visual Basic. In Project Explorer, expand the affected document project and open ThisDocument. Locate Document_ContentControlOnExit or the shading routine it calls.

2
Replace the automatic reset color

Find the shading-reset statement that uses wdColorAutomatic and replace that constant with wdColorWhite. For example, if the event argument is named ContentControl, the background-reset statement may be: ContentControl.Range.Shading.BackgroundPatternColor = wdColorWhite. Retain the object name and shading property used by your existing code.

3
Match a nonwhite page background

If Design > Page Color shows a nonwhite background, replace wdColorWhite with the corresponding color value, such as RGB(red, green, blue), using the page color's RGB values.

4
Test exits with and without edits

Return to Word, enter a date-picker control, and click outside it without choosing a date. Repeat with plain-text and drop-down controls, then repeat after changing each value. Confirm that shading clears in both cases; if your project also has custom OnChange code, test that path as well.

Set an explicit background color in the content control exit handler
White shading is an explicit color: This workaround makes the shaded area match a white page; it does not necessarily remove the underlying shading formatting. Recheck the reset color if you later change the page background.
Free Microsoft Office alternative

Use WPS Writer for everyday Word document editing

WPS Writer is a free, lightweight alternative with a familiar editing interface and Microsoft Word format compatibility, making migration straightforward for ordinary documents. It does not fix Word's VBA content control events; keep macro-dependent forms in Word unless you have verified their behavior in your WPS version.

Open and edit Microsoft Word .doc and .docx files.Use familiar document editing and formatting tools with minimal relearning.Handle everyday text and date-entry documents without relying on a custom Word highlighting macro.Move ordinary Word documents into a free, lightweight office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the yellow shading remain when I leave a date picker without selecting a date?

The reported VBA reset using wdColorAutomatic can leave the yellow shading visible, even when the control is exited. Open Developer > Visual Basic and check the ContentControlOnExit handler. Replace the reset color with wdColorWhite, or the actual page color, and test an exit without changing the value.

Will this fix also work for plain-text and drop-down content controls?

The same issue was reported for both control types in Word 2013 and Word 2019. Apply the explicit-color reset in the shared exit handler, then enter and leave each control without editing it to verify the result.

Should I use OnExit or OnChange to clear the shading?

Use Document_ContentControlOnExit for clearing shading when the user leaves a control, including when no value changes. If your project implements a custom OnChange event, test it too, but do not rely on a change-only path to handle unchanged controls.

What should I use instead of wdColorWhite on a colored page?

Check Design > Page Color and use the matching color value in the VBA reset statement. For a custom color, use RGB(red, green, blue) with that page color's values so the control background blends with the page.

Can WPS Writer repair the Word macro causing this shading problem?

No. This fix belongs in Microsoft Word's VBA event code. WPS Writer is an alternative for ordinary .doc and .docx editing, but you should verify support for any macro-dependent content controls before moving an automated form.