Compare word document in excel

K

KK

Private Sub Start_Click()


Dim Word As Object
Set Word = CreateObject("Word.application")

Dim name, name2 As String

Application.DisplayAlerts = False
Word.Documents.Open (OfFile), ReadOnly:=True
Word.Visible = True
name = Word.ActiveDocument.name

Word.Documents.Open (rfFile), ReadOnly:=True
Word.Visible = True
name2 = Word.ActiveDocument.name

Word.Activate
Application.CompareDocuments OriginalDocument:=Documents(name), _
RevisedDocument:=Documents(name2), _
Destination:=wdCompareDestinationNew, _
Granularity:=wdGranularityWordLevel, CompareFormatting:=True, _
CompareCaseChanges:=True, CompareWhitespace:=True,
CompareTables:=True, _
CompareHeaders:=True, CompareFootnotes:=True,
CompareTextboxes:=True, _
CompareFields:=True, CompareComments:=True, CompareMoves:=True, _
RevisedAuthor:="KkK", IgnoreAllComparisonWarnings:=False

ActiveWindow.ShowSourceDocuments = wdShowSourceDocumentsBoth


End Sub

How can i compare two word document in excel , then display result in
Microsoft word???
 
K

KK

Private Sub Start_Click()


Dim Word As Object
Set Word = CreateObject("Word.application")

Dim name, name2 As String

Application.DisplayAlerts = False
Word.Documents.Open (OfFile), ReadOnly:=True
Word.Visible = True
name = Word.ActiveDocument.name

Word.Documents.Open (rfFile), ReadOnly:=True
Word.Visible = True
name2 = Word.ActiveDocument.name

Word.Activate
Word.Documents(rfFile).Select
Word.CompareDocuments OriginalDocument:=Documents(name), _
RevisedDocument:=Documents(name2), _
Destination:=wdCompareDestinationNew, _
Granularity:=wdGranularityWordLevel, CompareFormatting:=True, _
CompareCaseChanges:=True, CompareWhitespace:=True,
CompareTables:=True, _
CompareHeaders:=True, CompareFootnotes:=True,
CompareTextboxes:=True, _
CompareFields:=True, CompareComments:=True, CompareMoves:=True, _
RevisedAuthor:="KK", IgnoreAllComparisonWarnings:=False

Word.ActiveWindow.ShowSourceDocuments = wdShowSourceDocumentsBoth
Word.Visible = True

Word.Documents(OfFile).Close
Word.Documents(rfFile).Close
Application.DisplayAlerts = True
Word.Quit
Set Word = Nothing



End Sub


Now i can compare the documents , but only once ,then show the run time
error "462",The remote server machine does not exist or is unavailable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top