View Single Post
 
Old 05-08-2023, 04:56 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I've done such a macro to gather metrics and detail the comments. I'm not convinced that detailing all the revisions is actually useful since the context of additions and deletions is important and there isn't much value in seeing just the deletion/addition in a sterile environment.

Since the macro I have is quite involved and proprietary, I'm not going to share all its workings in one go but can help guide you through the development of your macro and help you with any sticking points.

Let's start with the basic idea of:
1. In an empty Word doc (aDoc), add a table (aTbl) to collect the statistics of each document examined. Add columns for filename, # comments, # revisions, etc
2. Start looping through a folder of documents. Open each doc and:
a. add a row to aTbl and report the current doc's basic info
b. While the current doc is open, at the end of aDoc insert the doc name and apply Heading style to it. Then if the revision count > 0 add a table below the heading to collect the revision info.

Here is step 1 along with most of the variables you will need for later steps.
Code:
  Dim objFSO As Object, objFolder As Object, objFile As Object
  Dim i As Integer, sPath As String, aPict As InlineShape, dblRatio As Double
  Dim aRng As Range, aRngHead As Range, aRngScope As Range, sFile As String
  Dim aShp As Shape, aDoc As Document, aDocSrc As Document, sVal As String
  Dim aTbl As Table, aTblComm As Table, aRow As Row, aComment As Comment
  Dim aFld As Field, sClass As String
  
  Set aDoc = ActiveDocument
  
  'Setup Log Table
  Set aTbl = aDoc.Tables.Add(aDoc.Range, 1, 4)
  With aTbl
    .Cell(1, 1).Range.Text = "Filename"
    .Cell(1, 2).Range.Text = "Comments"
    .Cell(1, 3).Range.Text = "Tracked Revs"
    .Cell(1, 4).Range.Text = "Other"
    .PreferredWidthType = wdPreferredWidthPercent
    .PreferredWidth = 100
    .Columns.PreferredWidthType = wdPreferredWidthPercent
    .Columns.PreferredWidth = 10
    .Columns(1).PreferredWidth = 70     '100 - (.Columns.Count - 1) * 10
  End With
If you get this first bit working, report back on what form the tracked revisions should take when you extract them to this summary doc. Post an example doc showing what you think it should contain to be meaningful to the reader. How would you want to show deleted/added graphics, table cells, large ranges etc?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote