![]() |
#2
|
||||
|
||||
![]()
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
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
batch processing, compare documents, summary tasks |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
batch compare word file | maimi23 | Word VBA | 1 | 09-23-2021 04:21 AM |
![]() |
Harry Gateaux | Word VBA | 6 | 11-19-2020 09:58 AM |
Batch Editing Word documents | sakhtar6 | Word VBA | 6 | 03-02-2020 02:49 PM |
![]() |
cdfj | Word VBA | 6 | 11-07-2012 01:03 PM |
![]() |
admin4ever | Word | 2 | 05-17-2011 09:44 AM |