Fix Empty Comments Created by a Word VBA Macro
Question details
Prevent a Word VBA macro from creating an empty comment or placing comment text in the wrong comment.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- A VBA macro adds comments to selected text, including after the user has worked with long comments.
- Observed behavior
- The macro occasionally creates an empty comment and places the intended text in the first comment.
Open the document in Word and make sure the macro comes from a trusted source. Select the text you want to comment on before running the macro.
Add the comment through the active document's Comments collection
Use the selected range as the comment anchor and supply the comment text directly when creating it.
In Word, open the Developer tab and select Visual Basic, then find the macro that creates the comment.
Replace the existing comment-creation statement with: ActiveDocument.Comments.Add Range:=Selection.Range, Text:="My automatically inserted test comment." Replace the sample text with your intended comment text.
Return to the document, select the text to annotate, and run the macro from Developer > Macros.
Open Review > Show Comments and verify that the new comment contains the intended text and is attached to the selected passage. Test again after working with a long comment.

Review Word Documents with WPS Writer
WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Word format compatibility. Open existing documents in WPS Writer for a smoother move between office suites; it does not repair Word's VBA behavior.

Frequently Asked Questions
Why use ActiveDocument.Comments.Add instead of relying on the Selection object?
ActiveDocument.Comments.Add creates the comment through the active document's Comments collection while using Selection.Range only as the anchor. Supplying Text in the same call can avoid some selection-related errors.
What should I check if the comment is attached to the wrong text?
Select the intended passage before running the macro from Developer > Macros. Also check whether another part of the macro changes the active document or selection before Comments.Add runs.
Will this change remove comments that are already empty?
No. The statement creates a new comment; it does not modify or delete existing comments. Use Review > Show Comments to find and remove unwanted comments.
How do I keep the macro in the Word document?
Use File > Save As and choose Word Macro-Enabled Document (.docm) if the macro is stored in the document.




