0

I want to replace all double spaces () in one of my Word document to single space (). To my extreme suprise, my copy of Microsoft Word 2013 Home is able to find double spaces, but isn't able to replace them, because it claims, that nothing was found in my document.

If I hit Ctrl + F, then left pane appears and when I enter to it, I can see, that I have over 350 occurences of double space in my particular document. When, on contrary, I press Ctrl + H and "Search and Replace" window appera, then when I enter to it and then click of Find Next, a message appears to inform me, that nothing was found in my document.

To make things even more twixed, if I stay in "Search and Replace" dialog, but switch from Replace to Find tab, enter double space there and click Find Next there, then -- again -- Word is automagically able to find all the 350+ occurrences of double space in my document.

What am I missing? How can Word be able to just find something, but isn't being able to find and replace the same thing with another thing? Is this some kind of weird book in Word or something really strange and weird about formatting of my (quite complex and large) document?

I have tried to restart Word and my computer. I have tried to safe this particular document into brand new file and open it back from that new file. And -- of course -- I have double checked, that no strange / non-standard options are checked Search options field (after clicking More), that nothing strange is selected in Format or no Special is used. This is just a base, unmodified search or replace process, that works like a charm for searching and fails completely on replacing.

  • Can you add a sample of the text you're trying this on? I've just tried on my machine and could find and replace double spaces without a problem. – Jonno Dec 31 '15 at 8:46
  • The samly is already given in the question itself. I'm trying to replace all the occurrences of double spaces with single space in my document. – trejder Jan 1 '16 at 23:50
1

For what it's worth, here is a macro I came up with that removes all the extra spaces in a document. Since it's somebody elese's macro I adapted a few years ago, I couldn't explain to you in any detail how it works.

Sub RemoveExtraSpaces()
'
' RemoveExtraSpaces Macro
' I wanted to be able to add the replacements to a list rather than repeating the same find command over and over
'
' Don't forget to add the comma and space when adding new exceptions!

ScreenUpdating = False

findArray = Array("   ", "  ", " ,", " .", " ;", "( ", " )", " ?", " !", ". ^p", "? ^p", "! ^p", "..", ",,", "^p ")
replArray = Array(" ", " ", ",", ".", ";", "(", ")", "?", "!", ".^p", "?^p", "!^p", ".", ",", "^p")

For i = 0 To UBound(findArray)
'Selection.Find.ClearFormatting
'Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = findArray(i)
.Replacement.Text = replArray(i)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next i


ScreenUpdating = True

End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.