Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Sep 2015
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Which documents have track changes?

    Is it possible to do a search of a directory to find which documents have comments and track changes?

    We work on 'units' of work, consisting of between a dozen and 60+ documents, in various sub-directories. We have a simple, but fallible system of renaming files if there are queries or checks required - i.e. there are comments or tracked changes in the document. At the end of working on a unit, the editor is asked to go back and double-check that all the files have been renamed correctly 'final' files have no comments; 'query' files do have comments etc. This can be quite tedious - open, scroll, close, open, scroll, close and so on.

    I generally insert the text from all my files into a blank document, jump to each revision and then manually check the relevant files. However, even that can be tedious as I have to go to each sub-directory, insert all the files, go to the next sub-directory, insert all the files.

    I'm hoping - given that Windows and Word are both Microsoft - that there's a search criteria I've missed, which will let me search in Windows Explorer and find all documents that have tracked changes or comments in them.

    Yes? No?

    Alternatively (as unlikely as it seems to me), would it possible to write a macro that says "go to the nominated directory and list all documents with tracked changes/comments"?

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    You could use a macro like the following:
    Code:
    Sub GetTrackedDocuments()
    Application.ScreenUpdating = False
    Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document, StrOut As String
    strDocNm = ActiveDocument.FullName
    strFolder = GetFolder
    If strFolder = "" Then Exit Sub
    strFile = Dir(strFolder & "\*.doc", vbNormal)
    While strFile <> ""
      If strFolder & "\" & strFile <> strDocNm Then
        Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
        With wdDoc
          If .Revisions.Count > 0 Then StrOut = StrOut & strFile & vbCr
          .Close SaveChanges:=True
        End With
      End If
      strFile = Dir()
    Wend
    ActiveDocument.Range.Text = StrOut
    Set wdDoc = Nothing
    Application.ScreenUpdating = True
    End Sub
    
    Function GetFolder() As String
    Dim oFolder As Object
    GetFolder = ""
    Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
    If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
    Set oFolder = Nothing
    End Function
    The above macro will output a report of any documents with tracked changes in the document body. The report is output to the document the macro is run from. Simply select the folder you want to test and sit back & wait while the macro processes all documents in that folder.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following 2 Users Say Thank You to macropod For This Useful Post:

    Lugh (2016-06-22),SueBk (2016-06-13)

  4. #3
    New Lounger
    Join Date
    Sep 2015
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That is brilliant. Thank you so much. A few small tweaks:
    I changed .doc to .docx because we work exclusively with .docx files.
    I added "If .Revisions.Count > 0 etc." My testing seemed to show that comments are not counted as revisions. I've tested it on a few dummy files at home, but looking forward to trying it tomorrow at work on a larger directory.
    Again, thank you so much. I thought I was maybe hoping for too much to be able to do it via VBA.

  5. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by SueBk View Post
    I changed .doc to .docx because we work exclusively with .docx files.
    As posted, the code works equally well with .doc, .docx and .docm files; your modification means it won't work with .doc or docm files.
    Quote Originally Posted by SueBk View Post
    I added "If .Revisions.Count > 0 etc." My testing seemed to show that comments are not counted as revisions.
    To list files with comments and/or revisions, change:
    If .Revisions.Count > 0 Then StrOut = StrOut & strFile & vbCr
    to:
    If (.Comments.Count > 0) Or (.Revisions.Count > 0) Then StrOut = StrOut & strFile & vbCr
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •