Avatar of Dave Swarthout
Dave Swarthout

asked on 

Find and delete a variable number of spaces following paragraph character

I receive some documents every week that need reformatting. They come with a mixture of non-breaking spaces and normal spaces at the beginning of each paragraph. I could use a simple Find & Replace (optionally embedded in a macro) to find the spurious characters and delete them but their number and distribution ae not the same week to week.

What I need is a few lines of code that find a paragraph mark and then somehow check each subsequent character and if it's a space delete it, continuing until a character in the range [A-Z] is reached. I will pre-process the docs to change all non-breaking spaces into normal spaces.

I'm working in Word 2003.

Thanks in advance.
Microsoft Word

Avatar of undefined
Last Comment
Dave Swarthout
Avatar of Rgonzo1971


pls try (using wildcards)
in Find what:

Open in new window

in Replace with

Open in new window

Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Have you tried an "Advanced Search" with

Open in new window

Avatar of Rgonzo1971

or you could try (without wildcards)
Find what

Open in new window

replace with

Open in new window

so you do not have to change the non-breaking spaces in "normal" spaces
Avatar of Rgonzo1971

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Dave Swarthout


Thanks much. That macro worked wonderfully.
Microsoft Word
Microsoft Word

Microsoft Word is a commercial document editing program that is part of the Microsoft Office suite. It features numerous text-editing tools for creating richly formatted documents, along with tools for the use of macros in Word documents. Word's native file formats are denoted either by a .doc or .docx file extension. Plugins permitting the Windows versions of Word to read and write formats it does not natively support, such as the OpenDocument format (ODF) are available. Word can import and display images in common bitmap formats such as JPG and GIF. It can also be used to create and display simple line-art.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo