Rediger

Del via


Document.DeleteAllCommentsShown method (Word)

Deletes all revisions in a specified document that are displayed on the screen.

Important

DeleteAllCommentsShown deletes the visible subset of comments. This includes active comments (shown) as well as resolved comments (indicated by comment hint).

Syntax

expression. DeleteAllCommentsShown

expression Required. A variable that represents a Document object.

Example

This example hides all comments made by "Jeff Smith" and deletes all other displayed comments.

Sub HideDeleteComments() 
 Dim rev As Reviewer 
 With ActiveWindow.View 
 'Display all comments and revisions 
 .ShowRevisionsAndComments = True 
 .ShowFormatChanges = True 
 .ShowInsertionsAndDeletions = True 
 
 For Each rev In .Reviewers 
 rev.Visible = True 
 Next 
 
 'Hide only the revisions/comments made by the 
 'reviewer named "Jeff Smith" 
 .Reviewers(Index:="Jeff Smith").Visible = False 
 End With 
 
 'Delete all comments displayed in the active view 
 ActiveDocument.DeleteAllCommentsShown 
End Sub

See also

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.