Find/Replace after Superscript (2007)

I have a very large document with more than 2,000 footnotes. For most of them, I placed 2 spaced after the footnote superscript which I would like to reduce to 1. However, I am afraid to do a simple Search/Replace of 2 spaces/1 space, since it may mess up section breaks and various other formatting issues. I tried the "Special" feature in the Search/Replace action. While it allows me to find superscripts followed by 2 spaces, it does not allow me to replace those 2 spaces with 1 without deleting the superscript. Do you have any advice?

Re: Find/Replace after Superscript (2007)

Welcome to Woody's Lounge!

I don't see why replacing two spaces with one would cause problems with section breaks etc. I'd try it to see if it works. Save the document before you do so; if things go wrong you can always undo the action or close the document without saving it.

Re: Find/Replace after Superscript (2007)

Try this. I don't know whether it is supported in Word 2007, but it works in Word 2003.

<LI>Open the "special" Footnotes pane. To do this:
*
<UL><LI>Make sure the document you want to search is active
<LI>Press Alt+F11 to open the Visual Basic Editor
<LI>If you do not see a blank area labeled Immediate, press Ctrl+G to open the Immediate window
<LI>Paste the following line of code into the Immediate window and then press Enter at the end to execute it

<LI>Close the Immediate window and VBE. When you return to your document, the Footnotes pane should be displayed
*

<LI>Click in the footnote pane and call up the Replace dialog. Click the More button to expand it and choose the Down option "just in case"
*
<LI>Run your replace for 2 spaces to 1. You can test by replacing with an otherwise unused character or set of characters first if you like.[/list]Any luck?

Re: Find/Replace after Superscript (2007)

I can't find a way to do exactly the replacement you want.
You could replace 2 spaces with 1 space in text and use More> Format > Style > Footnote Text. This will avoid making any changes in the main document.

Re: Find/Replace after Superscript (2007)

Hans,

I think the requirement was to leave single spaces alone, and to replace double spaces with single spaces. So you would want something more like.

Sub RemoveDoubleSpacesFromFootnotes()
Dim ftn As Footnote
For Each ftn In ActiveDocument.Footnotes
If ftn.Range.Characters(1) = " " And ftn.Range.Characters(2) = " " Then
ftn.Range.Characters(1).Delete
End If
Next ftn
End Sub

(I guess this might need a check to make sure there are at least two characters in the footnote, but the risk is low).

Re: Find/Replace after Superscript (2007)

You all are great! Thanks for the quick replies. I miscommunicated what I am trying to do. I have a doctoral dissertation that is 271,000 words and is over 500 pages (A4) single spaced. There are approximately 2,000 footnotes. So, I am hesitant to do the Search/Replace 2 spaces with 1 given some possible formatting that may get messed up as a result. I would prefer not to have to go back and check every page and paragraph and section breaks for accuracy, since the document is so large. My problem is not with the footnotes themselves. Rather, it is with the footnote superscript in the Normal text. It is after those superscripts that I wish to replace 2 spaces with 1.

Re: Find/Replace after Superscript (2007)

You can do that without a macro:
- Select Edit | Replace...
- Click More>>
- Tick the "Use Wildcards" check box.
- Enter the following in the Find what box:

(^2 )( )

- Enter the following in the Replace with box:

1

- Click Replace All. Or if you'd like to test a few instances first, click Find Next, then click Replace.

Explanation: the code for a footnote marker is ASCII character 2. ^2 lets you search for ASCII character 2.
The expression (^2 )( ) in the Find what box means that you search for a footnote marker followed by a space and another space, i.e. by 2 spaces. The brackets divide the search text into two parts that you can refer to in the Replace with box as 1 and 2.
We just use 1 in the Replace with box, i.e. the first part: the footnote marker followed by a space. The second part (the second space) is discarded.