Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
page number printing on a merged report | Mailmerge | |||
Keep original formatting of document INSERTED into another doc? | Microsoft Word Help | |||
hiding tracked changes - original document information | Microsoft Word Help | |||
can i recover an original document which i have saved new text ov. | Microsoft Word Help | |||
Word won't close after I emailed a document | Microsoft Word Help |