Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2021, 04:23 AM
WJSwanepoel WJSwanepoel is offline Getting rid of Non-breaking space Windows 10 Getting rid of Non-breaking space Office 2007
Advanced Beginner
Getting rid of Non-breaking space
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 63
WJSwanepoel is on a distinguished road
Question Getting rid of Non-breaking space

I have a problem which I am battling to solve. I am wondering if someone has done something similar:

I have several documents which contain strings such as:


1. Word$n:m (n and m being one, two or three digit numbers)
2. Word$n (as above)
3. x$Word$n:m (x = 1, 2 or 3)
4. x$Word$n (x = 1, 2 or 3)

Word being any word appearing in an array of words. The words are case sensitive.
$ = a non-breaking space

As each occurrence is found I need to replace the non-breaking space with a normal space.

Thank you in advance for any assistance.
Reply With Quote
  #2  
Old 03-30-2021, 08:37 AM
Charles Kenyon Charles Kenyon is online now Getting rid of Non-breaking space Windows 10 Getting rid of Non-breaking space Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

If you use a space in the find box, it should find the non-breaking space. Replace it with a space character and you should have accomplished what you want.

Is there a reason this is posted in the vba forum rather than the general Word forum?
If not, I can move it there.
Reply With Quote
  #3  
Old 03-30-2021, 09:03 AM
WJSwanepoel WJSwanepoel is offline Getting rid of Non-breaking space Windows 10 Getting rid of Non-breaking space Office 2007
Advanced Beginner
Getting rid of Non-breaking space
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 63
WJSwanepoel is on a distinguished road
Default Many replaces to do

Quote:
Originally Posted by Charles Kenyon View Post
If you use a space in the find box, it should find the non-breaking space. Replace it with a space character and you should have accomplished what you want.

Is there a reason this is posted in the vba forum rather than the general Word forum?
If not, I can move it there.

The reason why I put it here is that there are some 130 different possibilities of the words, so I was hoping to do it with VBA, rather than a word at a time with a find/replace.
Reply With Quote
  #4  
Old 03-30-2021, 11:35 PM
macropod's Avatar
macropod macropod is offline Getting rid of Non-breaking space Windows 10 Getting rid of Non-breaking space Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could, of course use a wildcard Find/Replace, where:
Find = ([A-Z][a-z]@)^s([0-9])
Replace = \1 \2
This would leave the non-breaking spaces before your 'Word' intact. If you're wedded to removing those, too, do a second wildcard Find/Replace, where:
Find = ([0-9])^s([A-Z][a-z]@ [0-9])
Replace = \1 \2
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
non-breaking-space, replace, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-breakable space to have same width as usual space dum Word 5 09-14-2020 03:49 AM
Getting rid of Non-breaking space autocorrect double space to single space frankjake Word 8 09-21-2018 05:44 PM
Getting rid of Non-breaking space In 2010 document set for no space between paragraphs, but getting large space. normancamp Word 10 12-25-2017 04:54 PM
Getting rid of Non-breaking space Autocorrect numbers followed by any string to have non-breaking space seanspotatobusiness Word 8 03-09-2017 05:09 AM
Getting rid of Non-breaking space Non-breaking space and similar characters gpr Word 2 07-10-2015 06:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft