Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / January 2006

Tip: Looking for answers? Try searching our database.

How to Close original Document after executing MailMerge.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Don - 13 Jan 2006 23:18 GMT
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
Doug Robbins - Word MVP - 14 Jan 2006 08:15 GMT
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
Signature

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

> Hello, I'm doing a MailMerge from within an access application using code.
> How do close the original document after running the execute statement
[quoted text clipped - 16 lines]
>   ' .ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> End With
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.