Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Vic Spainhower
 
Posts: n/a
Default The remote server machine does not exist or is unavailable on Mail Merge

Hello,

I am trying to do a Mail Mege with VB6 and MS Word 2002 which will work fine
for the first one document. However, if I select ther merge document a
second time it blows on the OpenDataSource statement with the error "The
remote server machine does not exist or is unavailable". I found several
instances of this on Google but unfortunately the solution was not posted.

TIA

Vic


Here's the code:

Private Sub mnuCoverLetter_Click()

Dim strLoginName As String
Dim strMyDocuments As String
Dim WordWasNotRunning As Boolean ' Flag For final word unload
Dim strDocument As String
Dim strWhereClause As String
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim oApp As Word.Application

Set oApp = CreateObject("Word.Application")

On Error GoTo ErrorHandler


Set WordApp = GetObject(, "Word.Application")
Set WordDoc = WordApp.Documents.Add(strMyDocuments & "\" & strDocument)

With WordDoc
strWhereClause = "WHERE JobID = '" & frmMain.txtJobid & "'"
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Documents and Settings\vic.HOME\My Documents\My Data
Sources\Hughes_Jobs vuCoverLetter.odc" _
, ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
format:=wdOpenFormatAuto, Connection:= _
"Provider=MSDASQL.1;Persist Security Info=True;Extended
Properties=""DSN=HughesSupply;Description=Hughes Supply
Jobs;UID=vic;APP=Microsoft Office
XP;WSID=VIC-XP;DATABASE=Hughes_Jobs;Trusted_Connection=Yes"";I nitial
Catalog=Hughes_Jobs" _
, SQLStatement:="SELECT * FROM ""vuCoverLetter""",
SQLStatement1:=strWhereClause, _
SubType:=wdMergeSubTypeOther
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.Destination = wdSendToNewDocument

End With

WordApp.Visible = True
WordApp.Application.Activate

Set WordApp = Nothing
Set WordDoc = Nothing
Set oApp = Nothing
Exit Sub

ErrorHandler:
MsgBox "Error: " & Err.Number & Err.Description

End Sub


 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I eliminate numerous "Mail Merge..." under my tool bar? JulieMae Microsoft Word Help 2 January 9th 05 10:45 PM
Mail merge toolbar unavailable after SP3 R Scott Lowden Mailmerge 1 December 1st 04 06:24 PM
How do I mail merge when only merge document is shown in tools? DaveAS Microsoft Word Help 2 December 1st 04 03:45 PM
Mail Merge Problem Cindy M -WordMVP- Mailmerge 0 November 30th 04 05:25 PM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM


All times are GMT +1. The time now is 07:21 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"