Mail merge error: Access 97 to Word 97 
Author Message
 Mail merge error: Access 97 to Word 97

I'm trying to duplicate the "solution" in KB#131583 (sending
the current record to word with automation).  The first time I
execute the code, Word gets started, document opens, merge takes
place (I made it a merge doc) and it prints.  (Is there any way to
specify the # copies on a mail merge?  sendkeys??).  Anyway it works
fine.

The second time I execute it, Word opens, then opens the document but
fails on the Mail Merge stmt with the following error:

Runtime error  '-2147023174(800706ba)'
automation error   RPC Server is unavailable

I've also noticed that after the first execution, if I click on
"Reset" fron the Run menu in Access prior to re-running the code,
it works every time.    Here's the code:

Public Sub mergeit()
Dim objword As Word.Application
Set objword = CreateObject("word.application")
  With objword
      .Visible = True
      .Documents.Open ("v:\winword8\welco.doc")
  End With

  With ActiveDocument.MailMerge
        .Destination = wdSendToNewDocument
        .Execute
  End With
objword.ActiveDocument.PrintOut Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=3, Pages:="",
PageType:=wdPrintAllPages, _
        Collate:=True, Background:=False, PrintToFile:=False

objword.ActiveDocument.Close savechanges:=wdDoNotSaveChanges 'close
merged doc
objword.ActiveDocument.Close savechanges:=wdDoNotSaveChanges  'close
original doc

objword.Quit
Set objword = Nothing

End Sub

Thanks for any help.

Paul Honore



Tue, 29 Aug 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Access 97 to Word Mail Merge Automation

2. Automation Error when automating Word 97 from Access 97

3. Mail Merge with Word 97

4. MS Word 97 Mail Merge with Oracle Datasource?

5. VB6 and Word 97 Mail Merge

6. Create Form Letter in Word 97 without using Mail Merge

7. Word 97 Mail Merge with VB

8. MS Word 97 Mail Merge with Oracle Datasource?

9. Word 97 mail merge

10. Help Needed - Passing Value from Access 97 to Word 97 Macro

11. Access 97 create a Word 97 letter

12. MailMerge from Access 97 to Word 97, value lost

 

 
Powered by phpBB® Forum Software