Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-08-2023, 04:56 PM
Guessed's Avatar
Guessed Guessed is offline Batch compare word documents with a summary report Windows 10 Batch compare word documents with a summary report 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
 

Tags
batch processing, compare documents, summary tasks



Similar Threads
Thread Thread Starter Forum Replies Last Post
batch compare word file maimi23 Word VBA 1 09-23-2021 04:21 AM
Batch compare word documents with a summary report Batch merging of Word documents 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
Batch compare word documents with a summary report Batch create Word documents cdfj Word VBA 6 11-07-2012 01:03 PM
Batch compare word documents with a summary report Can you compare two word documents? (Automatically) admin4ever Word 2 05-17-2011 09:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft