make Word more clever for me please
May 6, 2009 5:11 AM   Subscribe

Help needed with footnotes in Word. (I know Word is terrible with footnotes and gives everyone grief, but these are straightforward things I'm wanting.)

There have been loads of questions about footnotes in Word, but I don't think mine has been asked. I am editing a document which has a reference section at the end of each chapter. It's quite straightforward, but there are a couple of things I'd like to do that MUST be possible because they seem so routine, and if I could find how to do these things it would make my life much easier.

Oh, this is Word 2003, by the way.

1. a) The place where each reference should be in the text is marked ***. I would love to be able to do a straight find/replace, swapping each *** for a footnote reference. But, while footnote reference is available in the find box, it's not in the replace box. Is there a way round this?

b) If that's not possible, I guess I have to find every ***, manually delete it, then insert the references individually. OK. What would make this easier would be if after I inserted the reference Word didn't jump down to the footnote area, because then I wouldn't have to scroll back up to the main text, click anywhere, and only then be able to click 'find next ***'. How can I stop Word jumping down there?

2. While I'm swapping those ***s for references I'm leaving the footnotes empty for the time being. When I've finished added all of them to a section, I have to copy the footnote text from another document. This is unformatted, except for paragraph breaks between each footnote. How can I copy and paste this all at once so Word knows that a paragraph break means 'this is the next footnote'? At the moment, I'm having to copy/paste these one-by-one and it is painful.

Thank you for your help.
posted by cincinnatus c to Computers & Internet (8 answers total)
 
Macros are really the only way to come at this. Here's one that will solve problems a) and b). Just bind the macro to a key combination and press it until there are no more ***'s.
Sub FOOTNOTESCAN()
'
' FOOTNOTESCAN Macro
' Macro recorded 5/6/2009 by
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "***"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.Delete Unit:=wdCharacter, Count:=1
    ActiveDocument.Footnotes.Add Range:=Selection.Range, Reference:=""
    If ActiveWindow.ActivePane.View.Type = wdPrintView Or ActiveWindow. _
        ActivePane.View.Type = wdWebView Or ActiveWindow.ActivePane.View.Type = _
        wdPrintPreview Then
        ActiveWindow.View.SeekView = wdSeekMainDocument
    Else
        ActiveWindow.Panes(2).Close
    End If
End Sub
As for c), it's not as pretty, but what I'd do is convert the footnotes to endnotes (Insert > Footnote > Options > Convert > Convert Footnotes to Endnotes), paste a big chunk of footnote paragraphs into the first footnote, and start highlighting/moving text to the right ones.
posted by cowbellemoo at 6:35 AM on May 6, 2009


I would love to be able to do a straight find/replace, swapping each *** for a footnote reference. But, while footnote reference is available in the find box, it's not in the replace box.

I'm using 2007 here, but I'm almost positive this technique hasn't changed since the earlier version. But if so, my apologies in advance if this doesn't work for you.

Bring up your Find and Replace dialog. Make sure you click on the More button with the two arrows on it [More >>]. This displays extra features for the Find and Replace functionality.

Type the *** in the Find text field, then click in the Replace text field. At the bottom of the dialog is a button that says "Format". Click that, and then click "Style". Scroll through the box until you find the "Footnote Reference" style, make sure it's highlighted, then click the OK button.

You'll be taken back to the Find and Replace dialog, from where you can now click the Find Next button, or the Replace button to get you started. (You could also click Replace All, but I assume you'd want to do this one at a time until you're sure it's working.)

And of course, caveat emptor, save early save often, make a backup first, etc., etc.
posted by SuperSquirrel at 6:52 AM on May 6, 2009


SuperSquirrel: I think your solution results only in changing the formatting of the text (to superscript and whatever else you define as footnote style), not creating actual footnotes.
posted by Ms. Next at 7:02 AM on May 6, 2009


Yeah, you're right, Ms. Next. Sorry op - I don't think my solution would work the way you want.
posted by SuperSquirrel at 7:12 AM on May 6, 2009


Oh, and make sure you back up your Normal.dot file before screwing with macros. This file can get corrupted by a slight breeze and make Word unable to start. It stores macros, key bindings, styles, and other stuff you likely don't want to lose if you're working alot in Word. Here is where it is:

C:\Documents and Settings\~USERNAME~\Application Data\Microsoft\Templates
posted by cowbellemoo at 7:20 AM on May 6, 2009 [1 favorite]


I'm not sure I have a clear picture of your situation, but take a look at Notestripper for Microsoft Word, with functions that include turning plain-text notes into embedded, automatically-numbered ones. They offer a 45-day free trial.
posted by Dave 9 at 7:26 AM on May 6, 2009


If you don't want to mess with macros, you can:

Press Ctrl-F; put "***" in the searchbox; press Enter; close the box.

Then use Ctrl-PgDn and Ctrl-PgUp to move between the instances of "***"; Then press Alt-I (for Insert) and then whatever shortcut keys will insert a footnote in your version of Word.

Lather, rinse, repeat.

You could use something like autohotkey to automate the keystroking.
posted by Monday, stony Monday at 4:48 PM on May 6, 2009


if you've used cowbellemoo's approach to create a bunch of empty footnotes, here's a way to do c).

If your footnotes are in a word document with only a single carriage return between paragraphs (meaning no double carriage returns between paragraphs), you can do the following:


1. Open the VBA editor (alt-F11), then doubleclick on "ThisDocument" under the Report document on the top left pane, and paste the following on the main right pane:
Sub paragraphfinder()
    Dim docReport As Document
    Dim docFootnotes As Document
    Set docReport = Documents("Document1")
    Set docFootnotes = Documents("Document2")
    
    
    If docReport.Footnotes.Count <> docFootnotes.paragraphs.Count Then
        MsgBox "There is a problem.  The report has " & docReport.Footnotes.Count & " blanks, but the footnote list has " & docFootnotes.paragraphs.Count & " paragraphs.  These should match."
        Exit Sub
    End If
    
    For x = 1 To docFootnotes.paragraphs.Count
        FootText = docFootnotes.paragraphs(x).Range.Text
        FootText = Left(FootText, Len(FootText) - 1)
        docReport.Footnotes(x).Range.Text = FootText
    Next
    
    MsgBox "Done"
End Sub
2. Replace "Document1" with the displayed name of the report (as shown on the title bar of Word), and "Document2" with the displayed name of the footnote file. Note that these names should still have quotes around them.

3. put your cursor somewhere inside the sub on the main pane, and press F5.

If you get the error message about the number of references, fix things so they are equal. Note that extra carriage returns at the end of the footnote document will mess up the count.

That should do it.


Option 2: If you happen to have the footnotes as a text document instead of a word document, the following code should work if you have the report document open and change the InputFile to the appropriate file.
Sub InsertFootnoteContents()


    InputFile = "C:\blahblahblah\footnotes.txt"
    notemax = ActiveDocument.Footnotes.Count
    Open InputFile For Input As #1
    
    noteindex = 1
    Do While Not EOF(1)
        Line Input #1, thisfootnote
        ActiveDocument.Footnotes(noteindex).Range.Text = thisfootnote
        If noteindex > notemax Then
            MsgBox "Oops! There are " & notemax & " endnotes in this document, but more than that in " & InputFile & "."
            Exit Do
        End If
        noteindex = noteindex + 1
        
    Loop
    Close #1
    
    MsgBox "Done"
End Sub

posted by i love cheese at 4:50 PM on May 6, 2009


« Older What song is this clip from?   |   Is drinking alcohol while taking antidepressants a... Newer »
This thread is closed to new comments.