ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run time error 462 (https://www.excelbanter.com/excel-programming/432373-run-time-error-462-a.html)

KK

Run time error 462
 
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.

joel

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

from
Word.CompareDocuments
to
Word.activedocument.CompareDocuments

"KK" wrote:

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.


KK

Run time error 462
 
HI Joel ,

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

KK

"Joel" wrote:

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

from
Word.CompareDocuments
to
Word.activedocument.CompareDocuments

"KK" wrote:

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.


keiji kounoike

Run time error 462
 
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

KK wrote:
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.


KK

Run time error 462
 
Hey kounoike , Thx a lot .This way was work .

"keiji kounoike" <"kounoike A | T ma.Pik" wrote:

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

KK wrote:
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.



keiji kounoike

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

Keiji

KK wrote:
Hey kounoike , Thx a lot .This way was work .

"keiji kounoike" <"kounoike A | T ma.Pik" wrote:

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

KK wrote:
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.



All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com