Sunday, January 20, 2013

Macro to delete multiple comments in MS Word 2003

There are times when a reviewed Test plan doc(or someother MS Word document) comes back with multiple comments that need addressing. Once these have been addressed, there is no option to delete all comments in the MS Word like "Accept All Changes in Document" option. You can delete each comment after you have address it (manually) or use the following vbs macro to delete all the comments at once.


Sub RemoveComments()
Dim commCount As Integer
Dim oDoc As Document
Set oDoc = ActiveDocument
For commCount = 1 To oDoc.Comments.Count
   oDoc.Comments(1).Delete
Next
End Sub

Alternatively you can use this macro.


Sub RemoveComments()
Dim oDoc As Document
Set oDoc = ActiveDocument
oDoc.DeleteAllComments End Sub

NOTE: In MS Word 2007 and later, there is an option to delete all comments at once.

No comments: