VBA & Macro Problems

How to Stop WindowSelectionChange from Resetting Format Painter in Word

WPS Content ManagerWPS Content Manager Oct 10, 2026 872 views

Question details

The user needs a way to prevent a Word VBA WindowSelectionChange event from deactivating the Format Painter tool after a single use.

How to Stop WindowSelectionChange from Resetting Format Painter in Word
Product
Word
Device & OS
not provided
Scenario
Running a VBA macro that relies on the WindowSelectionChange event while simultaneously trying to use the Format Painter tool to apply formatting across a document.
Observed behavior
The WindowSelectionChange event resets the active state of the Format Painter, preventing the user from double-clicking the tool to keep it continuously active for multiple formatting applications.
Before you start

Save your current Word document and temporarily pause any active macros to ensure they do not interfere while you test formatting shortcut alternatives.

Solution 1Recommended

Use Keyboard Shortcuts for Repeated Format Pasting

Bypass the Format Painter button entirely by using native copy-and-paste formatting keyboard shortcuts, which are not interrupted by the WindowSelectionChange event.

The Ribbon's Format Painter uses an internal CopyFormat behavior that is not fully exposed to VBA. Consequently, triggering a WindowSelectionChange event disrupts its active state, deactivating it prematurely.

To bypass this limitation, you can use the macro-interceptable PasteFormat command via native keyboard shortcuts. This method allows you to continuously apply formats without the event resetting your tool.

1
Select Source Text

Highlight the text in your document that contains the formatting you wish to copy.

2
Copy Formatting

Press Ctrl + Shift + C on your keyboard. This copies only the formatting, not the text itself, to the clipboard.

3
Select Target Text

Highlight the unformatted text or paragraphs where you want to apply the copied formatting.

4
Paste Formatting Repeatedly

Press Ctrl + Shift + V to apply the formatting. Because this action does not trigger the same continuous-mode UI state as the Format Painter button, you can move to new text and press Ctrl + Shift + V as many times as needed without VBA interference.

Clipboard Persistence: The copied formatting remains active on your clipboard until you copy a new format or text, giving you total freedom to navigate and format your document.
Free Microsoft Office alternative

Experience Seamless Formatting and Macro Support with WPS Office

If VBA limitations and macro interruptions in Microsoft Word are slowing down your workflow, consider switching to WPS Office. It provides a free, lightweight, and easy-to-use alternative with a familiar UI, offering exceptional format compatibility and reliable document editing.

  1. 1. Download and Install: Get WPS Office for free from the official website and install it on your computer.
  2. 2. Open Your Document: Launch WPS Writer and open your existing Microsoft Word documents effortlessly.
  3. 3. Apply Formatting Freely: Use the built-in Format Painter and advanced styling tools to edit your document smoothly.
High compatibility with Microsoft Word (.docx, .docm) formats, templates, and macros.Advanced formatting tools that work seamlessly without UI interruptions.Familiar user interface ensures a seamless migration with zero learning curve.Free and lightweight architecture ensures fast loading and smooth performance.
microsoft office alternative - wps office

Frequently Asked Questions

Can I intercept the Format Painter button click using VBA?

No. The internal code and behavior behind the Ribbon's Format Painter button are not exposed to VBA, meaning it cannot be directly intercepted, modified, or forced to stay active via macros.

Why does double-clicking the Format Painter not keep it active?

Double-clicking usually locks the Format Painter in a continuous state. However, if a background macro triggers a WindowSelectionChange event, it interrupts the document's selection state, which immediately forces the continuous mode to reset and deactivate.

What is the VBA equivalent to pasting formatting?

The macro-interceptable command for pasting formats is PasteFormat, which is the exact underlying command executed when you use the Ctrl + Shift + V keyboard shortcut.