View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Don
 
Posts: n/a
Default How to Close original Document after executing MailMerge.

Hello, I'm doing a MailMerge from within an access application using code.
How do close the original document after running the execute statement that
opens my second word document. I want to close the original
document(MasterTest.doc) with no prompts to user but keep the new document
open.

Dim objApp As Object
Dim strDocName As String
strDocName = rs!ClosingDir & "\MasterTest.doc"
Set objApp = CreateObject("Word.application")
With objApp
.Visible = True
.Documents.Open strDocName
.activedocument.mailmerge.Destination = 0 'wdSendToNewDocument
.activedocument.mailmerge.Execute
'***Somehow close original document
'.Close 0 'wdDoNotSaveChanges
' .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
End With