RSS Amplifier

Macro of the Month · Apr 27, 2026

SpacesCleanup

0
Sign in to vote or save

Jennifer Yankopolus · Macro of the Month

Last month’s macro was one of the most popular ones featured in the newsletter. Who knew that content control boxes were such a common problem? If you missed it, you can read it here. This month’s macro helps you tackle another global issue: cleaning up different types of unwanted spaces.

Editors face all types of spacing errors introduced by authors who add extraneous spaces when typing, copy text from the web, and convert documents from other platforms.

This month’s macro corrects multiple spacing issues in one step—and it doesn’t track the change:

  • Multiple spaces (two or more)

  • Nonbreaking spaces (also known as hard spaces)

  • Spaces at the end of a paragraph

  • Spaces before a tab

Run SpacesCleanup once before you start a project to rid the text of distracting spacing errors, including those that appear inside footnotes and endnotes, without a single tracked change to clutter your document. However, if your client requires you to track every edit you make, even those to fix spacing issues, see the instructions below for how to customize the code.

Tip: Run SpacesCleanup from a Custom Ribbon

This month’s macro is a perfect candidate to run from a custom ribbon rather than a keyboard shortcut. Setting up a custom ribbon for occasionally used macros keeps them within easy reach, freeing you from having to remember key combinations you rarely use.

Custom Word macro ribbon containing the following macro buttons, from left to right: ProperNounAlyse, HyphenAlyse, WordPairAlyse, HighlightWordList, FRedit, SpacesCleanup, %, AutoListOff, CountPhrase, HighlightSame, HyphenSpaceWordCount, WhatChar, DeleteAllComments, CommentCopier, TrackSimplifier, ContentControlsRemove, MaggyIt.
An example of a custom ribbon for macros, including SpacesCleanup. Shown on a Mac; the setup on a PC is similar.

You can customize the functionality of the macro in two ways by making simple modifications to lines of code located toward the top:

  • Track all the edits: To have the macro track all the changes it makes:

    • Add an apostrophe in front of this line of code:
      doTrack = False

    • Delete the apostrophe at the beginning of this line of code:

      ' doTrack = True

  • Apply highlighting to the edits: To have the macro highlight all the changes it makes:

    • Add an apostrophe in front of this line of code:

      myHighlight = 0

    • Delete the apostrophe at the beginning of this line of code:

      ' doHighlight = wdYellow

Have a question or want to suggest a macro for a future newsletter—or just want to say hi? Reply to this email.

Happy macroing,
Jennifer

ps: When was the last time you backed up your macros and keyboard shortcuts? If you can’t remember, now is a good time.

Thank you for reading Macro of the Month. If you found this post useful, please share it with other editors.

Share

Read the original on macroofthemonth.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.