A macro to reinsert Word footnotes

73 Views Asked by At

I need to make all footnotes in word visible (sometimes they are not, when converted to PDF) and the best way to do so I found is to recreate them.

To do so I select the text of the footnote (from end of the footnote CTRL+SHIFT+Arrow up; SHIFT-RIGHT twice; CTRL+V); go to the footnote mark in the text (missing right mouse click in recorder - "Go to Footnote"); SHIFT-RIGHT to select the footnote mark; delete it (DEL); and Add footnote (Alt+CTRL+F); paste in the copied footnote text (CTRL+V). Move to the next one. For the moment I am stuck in the recorder at "Go to footnote". Any help would be welcome! Thanks!

1

There are 1 best solutions below

0
Oscar  Sun On

OK, try this then:

Sub A_macro_to_reinsert_Word_footnotes()
    Dim ft As Footnote, ftNew As Footnote, i As Long, ftcntr As Long, d As Document, ur As UndoRecord
    Set ur = Word.Application.UndoRecord
    ur.StartCustomRecord "A_macro_to_reinsert_Word_footnotes"
    Set d = ActiveDocument
    ftcntr = d.Footnotes.Count
    For i = 1 To ftcntr
        Set ft = d.Footnotes(i)
        
        Rem just for test
'        ft.Reference.Select
'        Stop

        Set ftNew = d.Footnotes.Add(d.Range(ft.Reference.End, ft.Reference.End))
        ftNew.Range.FormattedText = ft.Range.FormattedText
        ft.Delete
    Next i
    ur.EndCustomRecord
End Sub