Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

VBA or function for WORD to find and delete extra spaces and linebreaks

Status
Not open for further replies.

Ingenuity

Structural
May 17, 2001
2,347
0
36
US
I have the titles of papers/books/references in my digital library that I need to amend into a simple filename-type format in UPPERCASE but without the linebreaks and extra spaces, using WORD, for example:

"Repairing unbonded {linebreak}
post-tensioned {extra space} concrete"

Becomes:

"REPAIRING UNBONDED POST-TENSIONED CONCRETE"

I can amend the text to UPPERCASE simply enough using a WORD command, but is there any way to automate the deletion of linebreaks and extras spaces between words, via a WORD function or some simple VBA code?

I have to repeat this task many, many times.

Thank you.



 
Replies continue below

Recommended for you

I generally just use search and replace until there are no more replacements made.

Replace linebreak with space.
Replace space space with space.
 
Thanks MintJulep

I did not release that Find and Replace works with linebreaks and spaces. It does indeed.

Thanks, again.
 
Among other things. The "Special" button in the extended dialog box lists about 20 characters that can be searched using letter codes.

One thing that's really annoying about copying a title from a PDF is the embedded returns, but it turns out that there are a number of programs, like Chrome, where if you paste this kind of title into the URL box, the returns will disappear, so copy | paste to Chrome | <CTRL>+A | copy gets rid of the extra returns.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
@IRstuff: Good to know re Chrome. Yes, that is exactly what I am trying - to efficiently delete the extra formatting embeds from PDF titles.
Thanks.
 
Just noticed that doing that same thing strips out extraneous spaces as well. This is what I get directly pasting a title into this dialog box:

24 MPixel 36 x 24 mm2 14 bit image sensor in 110/90 nm CMOS technology

This is what I get after pasting the same thing in Chrome's URL box:

24 MPixel 36 x 24 mm2 14 bit image sensor in 110/90 nm CMOS technology

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
 
Status
Not open for further replies.
Back
Top