View Single Post
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Neitsdelf Neitsdelf is offline
external usenet poster
 
Posts: 1
Default Word 2007: How to Compare current document?

My company just upgraded me to Word 2007 and since I compare documents many times a day, I couldn't live without the old functionality. So I hocked up the following macro to do it the old way (sort of):

Sub LegalBlacklineMyWay()
'by A. Feldstein 4/26/11
Dim fd As FileDialog 'Point to the dialog object
Dim CompareName As String 'Name of doc to compare to, as determined by
Dim WindowTitle As String
Dim CompareDocWasOpen As Boolean
Dim ResultDocument As Document
WindowTitle = "Compare Current Document (My Way)"
If Documents.Count 1 Then MsgBox "No document to compare.", vbInformation, WindowTitle: Exit Sub
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = False
.ButtonName = "Compare"
'Start in same directory like Word 2003
.InitialFileName = ActiveDocument.Path
.title = WindowTitle
If .Show -1 Then Exit Sub
CompareName = .SelectedItems.Item(1)
CompareDocWasOpen = AlreadyOpen(CompareName)
If Not CompareDocWasOpen Then Documents.Open FileName:=CompareName, Visible:=False
Set ResultDocument = Application.CompareDocuments( _
OriginalDocument:=Documents(CompareName), _
RevisedDocument:=ActiveDocument, _
Destination:=wdCompareDestinationNew, _
Granularity:=wdGranularityCharLevel, _
CompareFormatting:=True, CompareCaseChanges:=True, _
CompareWhitespace:=True, _
CompareTables:=True, _
CompareHeaders:=True, _
CompareFootnotes:=True, _
CompareTextboxes:=True, _
CompareFields:=True, _
CompareComments:=True, _
CompareMoves:=True, _
RevisedAuthor:=Application.UserInitials, _
IgnoreAllComparisonWarnings:=False)
ResultDocument.TrackRevisions = True 'My way
ResultDocument.Saved = False 'My way
If Not CompareDocWasOpen Then Documents(CompareName).Close
End With
Set fd = Nothing
Set ResultDocument = Nothing
End Sub