View Single Post
  #1   Report Post  
Dave Gaines Dave Gaines is offline
Junior Member
 
Posts: 0
Default Macro to Merge/Combine Multiple Revised Documents, Saving All Revisions and Comments

Hi all,

My issue is that I have written a macro to combine Tracked Changes and Comments from multiple reviewers into a single document. The code appears to work on its face, and I end up with a single document with numerous Tracked Changes and Comments, all associated with different Reviewer names.

Upon further examination, however, I find two issues with the merging of Revisions:

1. Sometimes, my current user name (David Gaines) is associated with a number of Revisions, even though I did not manually edit the source document. I suspect this is somehow caused by a glitch in my code or in Microsoft Word, wherein it is associating the current user (me) with some of the Revisions. Any insight into how to avoid this would be much appreciated.

2. Some of the Revisions are not being captured correctly in the final combined document. Specifically, a Revision shows alongside the original text instead of replacing it. Here's an example:

Original: The dog ran outside.
Revised: The cat ran outside.
Merged Result The dogcat ran outside.

When I combine the documents manually, I can get it to work correctly by changing the order in which I Combine documents, but can't figure out the "correct" order. Am thinking maybe the "Date Modified" file attribute determines which is the "original file?" In any case, thought I'd reach out for some "professional" help. My current code is provided below.

strInitialFileName = Dir$(strFolder & "*.do*")
strChangedFileName = Dir$()
If strChangedFileName "" Then
* * Do Until strChangedFileName = ""
* * * * Application.MergeDocuments OriginalDocument:=Documents.Open(FileName:=strFold er & strInitialFileName, Visible:=False), _
* * * * * * RevisedDocument:=Documents.Open(FileName:=strFolde r & strChangedFileName, Visible:=False), _
* * * * * * Destination:=wdCompareDestinationOriginal, Granularity:=wdGranularityCharLevel, _
* * * * * * CompareFormatting:=False, CompareCaseChanges:=True, CompareWhitespace:= _
* * * * * * True, CompareTables:=True, CompareHeaders:=True, CompareFootnotes:=True, _
* * * * * * CompareTextboxes:=True, CompareFields:=True, CompareComments:=True, _
* * * * * * CompareMoves:=True, FormatFrom:=wdMergeFormatFromOriginal
* * * * Documents(strChangedFileName).Close (wdDoNotSaveChanges)
* * * * Documents(strInitialFileName).Save
* * * * strChangedFileName = Dir$()
* * Loop
Else
* * Documents.Open strFolder & strInitialFileName, ReadOnly:=True
End If