PDA

View Full Version : Testing whether doc has tracked changes



cc_brewster
02-01-2011, 12:34 PM
I need my code to query "are there any tracked changes or comments in this document?". I don't see how to do it. Thanks for suggestions.

gmaxey
02-01-2011, 01:30 PM
Sub ScratchMacro()
Select Case True
Case ActiveDocument.Comments.Count = 0 And ActiveDocument.Revisions.Count = 0
MsgBox "There are no comments or revisions in this document."
Case ActiveDocument.Comments.Count = 0
MsgBox "This document contains revisions but no comments."
Case ActiveDocument.Revisions.Count = 0
MsgBox "This document contains comments but no revisions."
Case Else
MsgBox "This document contains comments and revisions."
End Select
End Sub

macropod
02-01-2011, 01:45 PM
I'd rather keep it simple:
Sub Demo()
With ActiveDocument
MsgBox "This document contains " & .Comments.Count & _
" comments and " & .Revisions.Count & " revisions."
End With
End Sub