Run time error 462

K

KK

Private Sub Start_Click()


ThisWorkbook.Activate
Dim Word As New Word.Application
Set Word = CreateObject("Word.Application")
Word.Visible = True

If (Word.Visible <> True) Then
Word.Visible = True
Else
End If

Dim name, name2 As String

Application.ScreenUpdating = False ' Turn off the screen updating
Application.DisplayAlerts = False

Word.Documents.Open (OfFile), ReadOnly:=True
name = Word.ActiveDocument.name

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

Word.Activate
Word.Documents(name).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.Documents(OfFile).Close
Word.Documents(rfFile).Close
Set Word = Nothing
Application.DisplayAlerts = True
Application.ScreenUpdating = True ' Turn off the screen updating

End Sub


Debug stop at Word.CompareDocuments ,Display the remote server machine does
not exist or is unavailable.
 
J

Joel

see if this fixes the problem I have 2003 whichhas a COMPARE method not a
COMPAREDOCUMENTS method.

from
Word.CompareDocuments
to
Word.activedocument.CompareDocuments
 
K

KK

HI Joel ,

I had try your way to fix problem , but it doesn't work .Anyway , thanks
for your help .

KK
 
K

keiji kounoike

How about modifying the line below in your code (added Word. before
Documents(name) and Documents(name2) )

Word.CompareDocuments OriginalDocument:=Documents(name), _
RevisedDocument:=Documents(name2), _

to

Word.CompareDocuments OriginalDocument:=Word.Documents(name), _
RevisedDocument:=Word.Documents(name2), _

Keiji
 
K

KK

Hey kounoike , Thx a lot .This way was work .

keiji kounoike" <"kounoike A | T ma.Pik said:
How about modifying the line below in your code (added Word. before
Documents(name) and Documents(name2) )

Word.CompareDocuments OriginalDocument:=Documents(name), _
RevisedDocument:=Documents(name2), _

to

Word.CompareDocuments OriginalDocument:=Word.Documents(name), _
RevisedDocument:=Word.Documents(name2), _

Keiji
 
K

keiji kounoike

Thanks for your feedback.
Off the subject, it seems that your code has some redundant lines and
unnecessary lines.

Keiji
 

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

Top