Share via

Extract Footnotes from Word to Excel

Anonymous
2016-11-15T23:47:05+00:00

Hi guys,

I am trying to create some Macro codes (without too much luck unfortunately, I'm just getting started with VBA) that extract all footnotes from a Microsoft Word document and export them to a new Excel document. I want each footnote in a new row in the excel file. I would really appreciate if someone can show me some sample codes!

Many thanks again!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
2016-11-16T00:12:48+00:00

The following will create a new workbook in which it inserts the footnote reference in the first column, the page on which the footnote appears in the second column and the text of the footnote in the third column

Sub ExtractFootnotes()

Dim xlapp As Object

Dim xlbook As Object

Dim xlsheet As Object

Dim i As Long, lognum As Long

Dim fnote As Footnote

On Error Resume Next

Set xlapp = GetObject(, "Excel.Application")

If Err Then

    bstartApp = True

    Set xlapp = CreateObject("Excel.Application")

End If

On Error GoTo 0

Set xlbook = xlapp.Workbooks.Add

Set xlsheet = xlbook.Worksheets(1)

With xlsheet.Range("A1")

    .Offset(0, 0).Value = "Foonote Ref"

    .Offset(0, 1).Value = "Page"

    .Offset(0, 2).Value = "Footnote Text"

    i = 1

    For Each fnote In ActiveDocument.Footnotes

        .Offset(i, 0).Value = fnote.Index

        .Offset(i, 1).Value = fnote.Range.Information(wdActiveEndPageNumber)

        .Offset(i, 2).Value = fnote.Range.Text

        i = i + 1

    Next fnote

End With

xlapp.visible = True

xlbook.Activate

Set xlapp = Nothing

Set xlbook = Nothing

Set xlsheet = Nothing

End Sub

Was this answer helpful?

5 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2016-11-16T00:32:39+00:00

    Many thanks Doug! This is really helpful!

    Was this answer helpful?

    0 comments No comments