Get revisions of Word Docs

August 25, 2006

On the lit support group in Yahoo, a question was posed as to how to get a list of all word documents that had track changes turned on.

Here is my solution. Do what you will with it. I nor my company accept any liabltiy for the results of excecuting this code. If I were you I’d back up your files first… Place this code into a new Word Document VBA Module. Its not pretty, but its the basics to work from.

Sub Revisions()

Dim fso As Scripting.FileSystemObject
Dim app As Word.Application
Dim mydoc As Word.Document
Dim fsoFolder As Folder
Dim folderStr As String
Dim file As file

Set fso = CreateObject(”Scripting.FilesystemObject”)

folderStr = InputBox(”Enter folder path”, “Enter Folder name”)

Set app = CreateObject(”Word.Application”)

Set fsoFolder = fso.GetFolder(folderStr)

For Each file In fsoFolder.Files

If Right(file.Name, 3) = “doc” Then

    Set mydoc = app.Documents.Open(file.Path)

    If mydoc.Revisions.Count > 0 Then

        Debug.Print mydoc.Name & ” ” & mydoc.Revisions.Count

    End If

End If

Next

End Sub

You can write out the Debug.Print file to a Text Stream Object. It works I think!

Martin.

http://ediscovery.wordpress.com