Reply
 
Thread Tools Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default How to Close original Document after executing MailMerge.

Dim objApp As Object
Dim strDocName As String
strDocName = rs!ClosingDir & "\MasterTest.doc"
Set objApp = CreateObject("Word.application")
With objApp
.Visible = True
Dim MainDoc as Document
Set MainDoc = .Documents.Open strDocName
With MainDoc
.mailmerge.Destination = 0 'wdSendToNewDocument
.mailmerge.Execute
.Close wdDoNotSaveChanges
End With
End With
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Don" wrote in message
...
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



Reply
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
page number printing on a merged report Print Page # On Merged Report Mailmerge 6 October 17th 05 05:18 AM
Keep original formatting of document INSERTED into another doc? jade3137 Microsoft Word Help 4 August 28th 05 12:26 PM
hiding tracked changes - original document information thank god its friday Microsoft Word Help 1 July 16th 05 12:46 AM
can i recover an original document which i have saved new text ov. Miles Microsoft Word Help 1 March 31st 05 12:01 AM
Word won't close after I emailed a document Carry Microsoft Word Help 0 March 29th 05 01:25 AM


All times are GMT +1. The time now is 07:42 PM.

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"