We help IT Professionals succeed at work.

run time error 462 the remote server machine does not exist

Last Modified: 2017-03-18
Hi All

When i run the code below for the first time i receive the error as per the title. When i run it a second time it run through correctly. I have read a bit on it and see that it could be late bindings or Implicit references but i don't really see if and where this would apply in the code below.
The code breaks on this line
 ActiveDocument.MailMerge.Fields.Add Range:=WdDoc.Bookmarks(cell.Offset(0, 2).Value).Range, Name:=txt & cell.Offset(0, 3).Value

Open in new window

Sub DoMerge()
Dim appWd As Word.Application
Dim WdDoc As Word.Document
Dim strBookFullName As String
Dim cell As Excel.Range
'Dim wdFind As Object
Dim txt As String
'Dim MyDoc As String

strBookFullName = ActiveWorkbook.FullName

Set appWd = CreateObject("Word.Application")
appWd.Visible = True

With appWd
    Set WdDoc = appWd.Documents.Open("C:\Users\Elmo\Documents\Aaron\2nd Project 2017\WorkingOn\VendorRebateClientDoc4March17_2.docx")
    WdDoc.MailMerge.OpenDataSource Name:=(strBookFullName), _
    ReadOnly:=True, LinkToSource:=0, AddToRecentFiles:=False, _
    PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
    WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
    Connection:="", SQLStatement:="SELECT * FROM `MergeRange`", SQLStatement1:=""

'Set wdFind = appWd.Selection.Find
    'finds text in word doc and replace with merge field
    For Each cell In Range("MergeText")
        'wdFind.Text = cell.Value
        'MyDoc = WdDoc.Range.Text
            txt = cell.Offset(0, 1).Value
            ActiveDocument.MailMerge.Fields.Add Range:=WdDoc.Bookmarks(cell.Offset(0, 2).Value).Range, Name:=txt & cell.Offset(0, 3).Value
    Next cell
    .ActiveDocument.SaveAs "C:\Users\Elmo\Documents\Aaron\From Client\Output\test2.docx"
End With

End Sub

Open in new window

Thanks in advance
Watch Question


Change these two lines:
Dim appWd As Word.Application
Dim WdDoc As Word.Document

Open in new window

To this:
Dim appWd As Object
Dim WdDoc As Object

Open in new window


Hi MarcoShadow

Now it works on the first run but gives the same error on the second run
Unlock this solution and get a sample of our free trial.
(No credit card required)


I found the answer on my own. The answers provided did nothing to solve the problem

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.