VBA & Macro Problems

How to Export Word Footnotes to Excel Using a VBA Macro

Algirdas JasaitisAlgirdas Jasaitis Nov 3, 2026 868 views

Question details

The user needs to extract footnote indexes, page numbers, and text from a Word document, export them into Excel, generate a text preview using a formula, and remove duplicate records on a separate sheet.

Export Word Footnotes to Excel and Remove Duplicate Records via VBA
Product
Microsoft Word and Excel
Device & OS
not provided
Scenario
Managing large documents with extensive footnotes and preparing them for data analysis or auditing in a spreadsheet.
Observed behavior
A programmatic VBA solution is required to automate the extraction, data manipulation via Left/Mid text extraction formulas, and deduplication of records.
Before you start

Ensure you have enabled the Developer tab in your word processor to access the VBA editor, and that your document contains the footnotes you wish to export.

Solution 1Recommended

Create a VBA Macro to Export Footnotes to Excel

Use a custom VBA script in Word to automatically generate an Excel workbook, extract footnote data, apply text preview formulas, and remove duplicates.

By utilizing Visual Basic for Applications (VBA), you can bridge Word and Excel to automate repetitive extraction tasks. This script will interact with the ActiveDocument object in Word to pull footnote properties and write them directly into an Excel sheet.

1
Open the VBA Editor

Press 'Alt + F11' in your Word document to open the Visual Basic for Applications editor.

2
Insert a New Module

Navigate to 'Insert' > 'Module' on the top menu to create a blank script window.

3
Write the Export Code

Write the VBA code that initializes an Excel Application object, loops through 'ActiveDocument.Footnotes', and outputs the 'Index', 'Reference.Information(wdActiveEndPageNumber)', and 'Range.Text' into the first sheet.

4
Insert Formulas

Add VBA lines to insert the text preview formula into your target column (e.g., column D). To use the advanced text formula requested, use cell.Formula = "=IFERROR(MID(C2,SEARCH(""xyz"",C2),16),LEFT(C2,16))" ensuring you double the internal quotation marks.

5
Copy and Deduplicate

Instruct the macro to copy the relevant columns (like A and D), paste them as values to Sheet2, and use the Excel 'RemoveDuplicates' method on the newly pasted data.

6
Run the Macro

Press 'F5' or click the 'Run' button on the toolbar to execute the macro and generate your customized Excel footnote report.

Create a VBA Macro to Export Footnotes to Excel
Excel Object Library Reference: You may need to enable the 'Microsoft Excel Object Library' reference in the VBA editor (Tools > References) to use early binding, or use Late Binding (CreateObject) to avoid reference errors.
Advanced VBA Support

Automate Document Tasks with WPS Office Macros

WPS Office provides robust support for VBA macros in its advanced versions, allowing you to run your Word-to-Excel footnote extraction scripts seamlessly. WPS Writer and WPS Spreadsheet offer high compatibility with standard VBA scripts.

  1. 1. Open WPS Writer: Launch WPS Office and open your document containing the footnotes you want to extract.
  2. 2. Access Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'VBA Editor'.
  3. 3. Paste and Run Script: Insert a new module, paste your customized footnote extraction script, and press F5 to execute.
  4. 4. Review Exported Data: WPS Spreadsheet will automatically open, populate the extracted footnote data, and perform the deduplication.
Seamless execution of Word-to-Excel VBA automation scripts.Highly compatible with Microsoft Word (.docx) and Excel (.xlsx) formats.Built-in Developer tools for macro recording and VBA editing.Lightweight suite with a highly familiar user interface.
microsoft office alternative - wps office

Frequently Asked Questions

How do I change the text preview formula in the VBA script?

You can modify the string assigned to the cell's .Formula property in your VBA code. For example, replace cell.Formula = "=LEFT(C2,16)" with cell.Formula = "=IFERROR(MID(C2,SEARCH(""xyz"",C2),16),LEFT(C2,16))". Be sure to double up the internal quotation marks around "xyz" so VBA parses the string correctly.

Why is my VBA macro failing on the RemoveDuplicates step?

Ensure you are referencing the correct Excel sheet and range. The RemoveDuplicates method requires specifying the exact columns array (e.g., Columns:=Array(2) if you want to deduplicate based on the second copied column) and declaring whether the range has a header.

Can I run this macro without having Excel installed?

No, if the VBA macro uses the Excel application object to create a workbook and remove duplicates, a compatible spreadsheet software (like Microsoft Excel or WPS Spreadsheet) must be installed on your device to handle the COM object requests.

How do I enable the Developer tab to access VBA?

Go to File > Options > Customize Ribbon, and check the box next to 'Developer' in the right-hand list. This will add the Developer tab to your main menu, granting you access to the VBA Editor.