Macro to Pull Footnotes

Hi All -

First off thanks as always - always appreciate the advice given here.

Is there a macro available (or would it be possible to create one) that pulls all footnotes and preferably puts them in a table. I have documents (many) with 200+ footnotes that I want each footnote in a new row in a table. If that's not possible - at least copying them unformatted to a new document would be an okay start.

Again thanks!

Answer
Answer

I believe that it did insert the footnotes into a table, but the table did not have borders applied to it and perhaps you did not have the Show Gridlines set.

However, the following code will retain any formatting applied to the footnote and also include in the first column of the table the footnote Index number.  Borders will also be applied to the table.

Dim afn As Footnote
Dim docsource As Document
Dim doctarget As Document
Dim rngtarget As Range
Set docsource = ActiveDocument
Set doctarget = Documents.Add
With docsource
    For Each afn In .Footnotes
        Set rngtarget = doctarget.Range
        rngtarget.Collapse wdCollapseEnd
        rngtarget.InsertAfter afn.Index & vbTab
        rngtarget.Collapse wdCollapseEnd
        rngtarget.FormattedText = afn.Range.FormattedText
        rngtarget.Collapse wdCollapseEnd
        rngtarget.InsertAfter vbCr
    Next
End With
doctarget.Range.ConvertToTable
With doctarget.Tables(1).Borders
    .InsideLineStyle = wdLineStyleSingle
    .OutsideLineStyle = wdLineStyleSingle
End With

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 569 Applies to: