Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2017, 01:47 PM
CrossReach CrossReach is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 10 A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2016
Advanced Beginner
A Widlcard or Macro to Properly Remove Spaces Between Commas?
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default A Widlcard or Macro to Properly Remove Spaces Between Commas?

I have a fairly large document with lots of quotes in inverted commas. When I try to remove them using search and replace it removes the spaces, but one side or the other then ends up connected to the preceding or following word.



So if I use find and replace to fix this sentence Luke adds the words " To repentance." It will bring the "To together but also the word following repententance."

Is there such a way that I can properly fix this without doing it line by line?

Thanks.
Reply With Quote
  #2  
Old 01-18-2017, 02:44 PM
macropod's Avatar
macropod macropod is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 7 64bit A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2010 32bit
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

If you're using smart quotes (i.e. “ & ”), you can search for one or the other, instead of using " - which finds both. Of course, if your document has the wrong smart quotes in some locations, those will still have to be processed manually. Alternatively, you might use a Find/Replace with:
Find = ^w"^w
Replace = ^32"
Instead of ^32 you could insert a space. This will find only those double-quotes that have white space before and after - thus leaving repentance." alone.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-18-2017, 02:56 PM
CrossReach CrossReach is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 10 A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2016
Advanced Beginner
A Widlcard or Macro to Properly Remove Spaces Between Commas?
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default

I have found when searching for smart quotes that it would change both sides anyway. Was that just me?

Will a variation of that find and replace option work if I just use ^w" or "^w?
Reply With Quote
  #4  
Old 01-19-2017, 05:26 PM
macropod's Avatar
macropod macropod is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 7 64bit A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2010 32bit
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

The ^w tells Word to find any white-space character (e.g. ordinary space, non-breaking space, tab). Using just ^w" will Find all double-quotes preceded by white-space and "^w will Find all double-quotes followed by white-space. What I understand you need to find is double-quotes that have white-space on both sides, hence the ^w"^w.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-22-2017, 01:59 PM
CrossReach CrossReach is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 10 A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2016
Advanced Beginner
A Widlcard or Macro to Properly Remove Spaces Between Commas?
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default

Thanks.

These are old works that have been OCR'ed. So many of the quotes have inverted commas on the left with a space between the word, but the last one does not. Like this:

" The quick brown fox jumps over the lazy dog"

Sometimes the space appears on the other side:

"The quick brown fox jumps over the lazy dog "

And sometimes on both sides:

" The quick brown fox jumps over the lazy dog "

What would be the set up to fix all three of these issues using Find and Replace?

Thanks again.
Reply With Quote
  #6  
Old 01-22-2017, 04:18 PM
macropod's Avatar
macropod macropod is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 7 64bit A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2010 32bit
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 can't automatically fix all those combinations via Find/Replace. You would need to do a Find/Replace with, say:
Find = "^w
Replace = "
and stepping though each one, replacing on a case-by-case basis, following by a Find/Replace with:
Find = ^w"
Replace = "
and stepping though each of those, replacing on a case-by-case basis. There is simply no way Word can tell whether a given quote mark is misplaced. Yes, a Find/Replace expression could be crafted to look for certain patterns, but that would be thrown off immediately there was a mismatch - I've seen far too many OCR'd documents where quotes have been misinterpreted as some other character to assume they'd all be OK.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 01-23-2017, 04:28 AM
CrossReach CrossReach is offline A Widlcard or Macro to Properly Remove Spaces Between Commas? Windows 10 A Widlcard or Macro to Properly Remove Spaces Between Commas? Office 2016
Advanced Beginner
A Widlcard or Macro to Properly Remove Spaces Between Commas?
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default

Hi,

Yes, that's what I meant. I wouldn't have imagined that Word could replace them all with one command. And your're right, OCR, especially when dealing with older documents, can't be trusted to convert a document correctly. But the program I have doesn't do a job, and knowing how to automatically remove as many discrepancies as possible before I go over it with the human eye still removes a huge amount of manual labor.

Thanks again for your help.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I remove spaces between only Chinese characters? sivartnosredna7 Word 2 01-09-2017 05:33 AM
How to remove spaces from Cells which are at the end of value? LearnerExcel Excel 2 12-19-2016 01:10 PM
Macro does not run properly dherr Word VBA 2 02-19-2015 08:50 AM
remove repeated words with " macro " or " wild cards " in texts with parentheses and commas jocke321 Word VBA 2 12-10-2014 11:27 AM
editing text and remove spaces romanticbiro Word VBA 5 07-04-2014 07:42 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 AM.


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