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
Rgonzo1971

Hi,

pls try (using wildcards)
in Find what:
^013(^0032)@

Open in new window

in Replace with
^013

Open in new window

Regards
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Have you tried an "Advanced Search" with
^w^v

Open in new window

Avatar of Rgonzo1971
Rgonzo1971

or you could try (without wildcards)
Find what
^013^w

Open in new window

replace with
^p

Open in new window

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
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

ASKER

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.

30K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

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