View Single Post
  #2   Report Post  
Posted to microsoft.public.word.formatting.longdocs
macropod
 
Posts: n/a
Default Footnotes and Endnotes, dealing with them from older programs in MS Word

Hi Bill,

Below is a macro to process your footnotes *and* retain any formatting (eg
bold/italic/underline).

The macro assumes the footnotes will all be grouped together, and requires
you to select them before running the code.

The macro also assumes you'll be using the "Footnote Text" style footnotes.
If not, you can simply change it in the line:
.Style = "Footnote Text"

The other important point to note is that, as coded, the macro only works
with single-paragraph footnotes. If you have any multi-paragraph footnotes,
you can get around that issue by changing their internal paragraph markers
to line feeds (i.e. Shift-Enter).

As it runs, the macro shows its progress on the status bar.

Sub ReLinkFootNotes()
Dim i As Integer
Dim j As Integer
Application.ScreenUpdating = False
With Selection
.Bookmarks.Add Range:=Selection.Range, Name:="FootNotes"
j = 0
For i = 1 To .Paragraphs.Count
If .Paragraphs(i).Range.Words(1) = j + 1 Then
j = j + 1
End If
Next i
End With
For i = 1 To j
StatusBar = "Finding Footnote Location: " & i
ActiveDocument.Select
With Selection.Find
.Forward = True
.Font.Superscript = True
.Text = i
.MatchWholeWord = False
.Execute
If .Found = True Then
.Parent.Select
With Selection
.Delete
.Footnotes.Add Range:=Selection.Range, Text:=""
End With
End If
End With
Next i
With ActiveDocument.Bookmarks("FootNotes").Range
For i = 1 To j
StatusBar = "Transferring Footnote: " & i
With .Paragraphs(1).Range
.Cut
With ActiveDocument.Footnotes(i).Range
.Paste
.Words(1).Delete
.Characters(.Characters.Count).Delete
.Style = "Footnote Text"
End With
End With
Next i
On Error Resume Next
.Bookmarks("FootNotes").Delete
End With
Application.ScreenUpdating = True
End Sub

How the code works:
.. Take the selected range of footnotes and bookmark them.
.. Count the number of bookmarked paragraphs with sequential numbers,
starting at '1'.
.. Find the corresponding superscripted sequential numbers in the document.
.. Turn matched superscripted sequential numbers into empty footnotes.
.. Cut the bookmarked footnote paragraphs and paste them into the empty
footnotes.
.. Delete the first word (footnote number) and last character (duplicate para
mark) from each footnote and apply the footnote style.
.. Delete the bookmark.

Cheers

--
macropod
[MVP - Microsoft Word]


"Bill From DegiCank" wrote in message
oups.com...
Anyone have any tips on dealing with footnotes from older programs
where the footnotes are not encoded as footnotes, and easily converting
them to proper footnotes in Word?

Example would be a 50 page document with superscript numbers throughout
that represent reference's, and taking that into word and modifying /
reformatting the document so that the page layout changes, but the
footnotes, go where ever they please.

Does anyone know of any tools that can handle this type of situation?