How to Export Microsoft Word Search Results with Page Numbers to Excel
Question details
The user needs to export every Microsoft Word search match together with its page number to Excel or Google Sheets because Word has no built-in command for this task.

- Product
- Microsoft Word
- Device & OS
- Windows
- Scenario
- The user has a Word document and wants to compile all search term occurrences and their page numbers in a spreadsheet for reference or analysis.
- Observed behavior
- Microsoft Word does not expose a built-in export command for search results, so the page numbers are not available in Excel or Google Sheets without a macro or a manual process.
Prepare a test copy of the Word document and create an Excel workbook with a header row containing Word in column A and Pages in column B before running any macro.
Export Word Search Matches and Page Numbers to Excel with a Word VBA Macro
Use this method when you need an automated export of multiple search terms and page numbers from a Word document into an Excel workbook.
Microsoft Word does not provide a built-in command to export every search match with its page number. A VBA macro can search a Word document and write each matching term and page number to an Excel workbook.
Open Excel and enter Word in cell A1 and Pages in cell B1, then save the workbook to a location such as C:\Users\[UserName]\Documents\WordList.xlsx.
In Microsoft Word, press Alt+F11 to open the VBA editor, then click Insert and choose Module to add a new module.
Paste the VBA macro that opens the Excel workbook, loops through each term in column A, uses Selection.Information(wdActiveEndPageNumber) to capture the page number for each match, and writes the page numbers to column B.
Update the workbook path in the code, then run the macro and open the Excel workbook to confirm that each search term now has page numbers in the Pages column.

Manually Record Word Search Results with the Navigation Pane and Copy Them to Excel
Use this fallback for small documents when you prefer not to run VBA macros.
Use WPS Office as a Free Microsoft Word Alternative for Document Editing and Export Workflows
WPS Office is a free, lightweight Office suite that opens, edits, and saves Microsoft Word .docx files with a familiar Word-like interface. While the specific Word VBA export macro belongs to Microsoft Word, WPS Office gives you a free environment to review, edit, and manage Word documents with strong format compatibility and easy migration.
- 1. Download WPS Office Free: Go to the WPS Office official download page and click Download WPS Office Free for your device.
- 2. Install and launch WPS Office: Run the downloaded installer, follow the on-screen prompts, and open WPS Office from the Start menu or Applications folder.
- 3. Open and edit your Word document: In WPS Writer, click File > Open, choose the .docx file, and use the familiar toolbar to review, edit, or save the document.

Frequently Asked Questions
Does Microsoft Word have a built-in option to export search results with page numbers?
No, Microsoft Word does not provide a built-in export command for search results. You need a VBA macro or a manual copy from the Navigation Pane to record matches and page numbers.
Can I export Word search results to Google Sheets instead of Excel?
Yes, you can adapt the VBA macro to write to an Excel workbook and then import or copy the result table into Google Sheets, or you can manually record matches and paste them into Google Sheets.
Which page number does the VBA macro capture for a search match?
The macro uses Selection.Information(wdActiveEndPageNumber) to return the page number of the active selection after each match is found.
Why should I test the macro on a copy of the Word document?
Testing on a copy prevents accidental changes to the original document and lets you verify the workbook path and macro output before processing large files.
Will this VBA macro work in WPS Writer?
The VBA macro is written for Microsoft Word. WPS Office is a free alternative for opening and editing .docx files, but this specific Word VBA export macro is best run in Microsoft Word.




