VBA & Macro Problems

Extract Word Comments into a New Document with VBA

Nimra MalikNimra Malik Nov 25, 2026 870 views

Question details

Extract comments from a Word document into a new document using a VBA macro, then transfer the comments to Excel if needed.

Extract Word Comments into a New Document with VBA
Product
Microsoft Word
Device & OS
not provided
Scenario
A user wants to run a macro from Word's Macros dialog to collect review comments for data management.
Observed behavior
The macro may not run when selected in the Macros dialog.
Before you start

Open the Word document containing the comments and confirm that it has at least one review comment. If you store the macro in the document, save it as a macro-enabled Word document (.docm) and enable macros only if you trust the file.

Solution 1Recommended

Create a public comment-extraction macro in a standard module

Use this method to create a runnable macro that copies comment authors and text into a new Word document.

1
Open the VBA editor

In Word, open Developer > Visual Basic. In the VBA editor, select the document or template where you want to store the macro, then choose Insert > Module.

2
Add the macro

Paste the following code into the standard module: Public Sub ExtractCommentsToNewDocument() Dim sourceDoc As Document Dim outputDoc As Document Dim c As Comment Set sourceDoc = ActiveDocument If sourceDoc.Comments.Count = 0 Then MsgBox "This document has no comments." Exit Sub End If Set outputDoc = Documents.Add For Each c In sourceDoc.Comments outputDoc.Content.InsertAfter "Author: " & c.Author & vbCr & _ "Comment: " & c.Range.Text & vbCr & vbCr Next c End Sub

3
Run the macro

Return to the document containing the comments. Choose Developer > Macros, select ExtractCommentsToNewDocument, and click Run. The macro creates a new document containing each comment's author and text.

4
Save or transfer the results

Use File > Save As to save the new Word document. To manage the results in Excel, copy the comment details and paste them into worksheet cells, arranging authors and comments into columns as needed.

Create a public comment-extraction macro in a standard module
Macro availability: The procedure must be public, have no required arguments, and be in a standard module for it to appear in the Macros dialog. A macro stored in a document must be saved in a macro-enabled format to remain available.
Free Microsoft Office alternative

Review Documents and Manage Comment Data with WPS Office

WPS Office is a free, lightweight alternative for working with documents and spreadsheets in a familiar interface. Open Microsoft Office files as you move your work to WPS; diagnosing or running the Word VBA macro itself still requires Microsoft Word.

Work with document content and spreadsheet data in one office suiteOpen and edit Microsoft Word DOCX and Excel XLSX filesUse a familiar interface for a smoother transition from Microsoft OfficeGet a free, lightweight office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't my macro appear in Word's Macros dialog?

In Developer > Visual Basic, check that the procedure is public, has no required arguments, and is stored in a standard module. Use Insert > Module to create one if necessary.

What should I do when the macro stops with an error?

Click Debug in the error dialog and inspect the highlighted line in the VBA editor. You can also use Debug > Step Into to follow execution one line at a time.

Will the example macro export comments directly to Excel?

No. It creates a new Word document containing comment authors and text. Copy the results from that document and paste them into Excel cells to organize them.

How do I keep the macro in my Word document?

Use File > Save As and choose a macro-enabled Word document (.docm). Enable macros when prompted only if you trust the file.