If you like to convert Microsoft Word’s DOC files to your e-book reader, you might encountered problem with footnotes. Some converters remove them completely, other ones make links which are rather difficult to reach on non-touch reader.
There are some VBA scripts for Word on the Internet to move footnotes to the place where their reference is. But they’re mostly pretty dumb. They move footnote to the actual place of the reference not respecting sentences or paragraphs.
So I slightly tuned one of them up. It moves footnote to the end of the paragraph with the reference and changes it’s appearance to smaller italics. It looks pretty rad now and it’s not that much intrusive.
Sub footnotes_to_inline()
Dim afn As Footnote
For Each afn In ActiveDocument.Footnotes
'get text from footnote and prepare inline text
Dim note As String
note = "(" & afn.Reference & afn.Range & ")" & Chr(10)
'copy reference of note to plain text
afn.Reference.InsertAfter afn.Reference.Text
'look for end of the paragraph and insert text of note
Selection.Start = afn.Reference.End
With Selection.Find
.Text = "^p"
.Forward = True
.Wrap = wdFindStop
.Execute
End With
Selection.InsertAfter note
'change inline note to bit smaller italic font
Dim format As Range
Set format = ActiveDocument.Range(Selection.Start, Selection.Start + Len(note))
format.Font.Italic = True
format.Font.Size = format.Font.Size - 1
Next afn
'delete original footnotes
For Each afn In ActiveDocument.Footnotes
afn.Reference.Delete
Next afn
End Sub
In Word, press Alt+F11 to start VBA and paste it there.
I’m completely noob in question of VBA, so this script may look as utter thrash for professionals. But it works! 🙂
