VBA & Macro Problems

How to Undo or Remove Changes Made by a Word VBA Macro

Tauseeq MagsiTauseeq Magsi Oct 28, 2026 869 views

Question details

The user needs to remove specific formatting changes (like underlines) applied by a VBA macro in a Word document without undoing edits made after the macro was run.

How to Undo or Remove Formatting Changes Made by a Word VBA Macro
Product
Microsoft Word
Device & OS
not provided
Scenario
The user ran a formatting macro, continued editing the document, and later realized the macro's formatting needs to be reversed without losing the new text edits.
Observed behavior
Using the standard Undo (Ctrl+Z) function would delete the recent text edits alongside the macro's formatting changes, which is undesirable.
Before you start

Always save a backup copy of your document before running any VBA macros or applying bulk formatting changes.

Solution 1Recommended

Manually Remove the Applied Formatting

Use built-in font tools to overwrite the specific formatting (such as underlines) applied by the macro without affecting recent text edits.

If a macro applied a single type of formatting across your document, the fastest way to reverse it is to manually apply the 'None' or default state for that specific format. This preserves all your newly typed text.

1
Select the document text

Press Ctrl+A on your keyboard to select the entire document, or highlight the specific sections modified by the macro.

2
Remove the specific format

Navigate to the Home tab. If the macro added underlines, click the Underline drop-down arrow and select 'None', or click the Underline button until the formatting disappears.

3
Use Clear Formatting (Optional)

If the macro applied multiple complex styles, you can click the 'Clear Formatting' icon (an 'A' with an eraser) on the Home tab to revert the text to the default Normal style.

Manually Remove the Applied Formatting
Edits Preserved: By targeting just the font attributes, your subsequent text edits and additions remain completely untouched.
Efficient Word Processing

Easily Manage Macros and Formatting with WPS Office

WPS Office provides robust tools for managing document formatting and supports VBA macros in its advanced versions, making it easy to apply, edit, or reverse bulk changes efficiently.

  1. 1. Open your document: Launch WPS Writer and open the Word document containing the unwanted macro formatting.
  2. 2. Select the affected text: Highlight the specific paragraphs you want to fix, or press Ctrl+A to select the entire document.
  3. 3. Clear or adjust formatting: Go to the Home tab and use the specific font tools (like Underline) to toggle the format off, or click the 'Clear Formatting' icon to instantly remove all macro-applied styles.
Fully compatible with Microsoft Word document formats (.docx, .doc)VBA editor available for running, debugging, and reversing macrosOne-click 'Clear Formatting' tool to quickly reset text stylesFree, lightweight application with a highly familiar user interface
QA img-9

Frequently Asked Questions

Can I just press Ctrl+Z to undo a macro?

Yes, but only immediately after running it. If you have made other edits since running the macro, pressing Ctrl+Z will undo your recent typing before it undoes the macro's changes.

Does the 'Clear Formatting' tool remove my font colors and bold text too?

Yes, 'Clear Formatting' strips all applied styles, returning the text to the default Normal style. If you want to keep other styles like bold or color, you should manually target just the unwanted attribute (like underlining) instead.

How can I prevent macros from permanently altering my document in the future?

The safest approach is to always save a duplicate version of your document before testing or running a new VBA macro. This ensures you have an untouched backup if the macro behaves unexpectedly.