×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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.



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

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

Replace linebreak with space.
Replace space space with space.

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

(OP)
Thanks MintJulep

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

Thanks, again.

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

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: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!

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

(OP)
@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.

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

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: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

Of course I can. I can do anything. I can do absolutely anything. I'm an expert!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources