If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
The actual "Merged" Document
Hi
I am trying to reference a merged document, hence I have my macro in the Template, which merges to a seperate document. I then bring this merged document (that can be called anything from "FormLetter1" to "Letters1") into PRINT PREVIEW format. From here, the user can choose what they want to do i.e. they can click on the "x" or File Close/Exit, and I want not only the print preview to close but the merged doc, e.g. Letters2 and then the template, BUT I cannot seem to reference this merged document as its name isnt always consistent. I am able to get the doc in print preview format, and close the template but as the macro is in the template I cannot close it, but am awaiting the user to click on File Exit, and once they do that everything will close, with NO CHANGES, i.e. the SAVE AS dialogue box shouldnt appear! I hope someone can help! Thanx alot! Preet x --- Message posted from http://www.ExcelForum.com/ |
#2
|
|||
|
|||
Dim maindoc as Document, mergeresult as Document
Set maindoc = ActiveDocument 'before the merge is executed With maindoc.MailMerge 'etc ' code to execute the merge End With 'after executing the merge, the result of the merge will be the active document so use Set mergeresult as ActiveDocument ' Now you have two document objects defined each of which can be acted upon independently by reference to either maindoc or mergeresult as appropriate. e.g. maindoc.Close wdDoNotSaveChanges -- Please respond to the Newsgroup for the benefit of others who may be interested. Questions sent directly to me will only be answered on a paid consulting basis. Hope this helps, Doug Robbins - Word MVP "Preet " wrote in message ... Hi I am trying to reference a merged document, hence I have my macro in the Template, which merges to a seperate document. I then bring this merged document (that can be called anything from "FormLetter1" to "Letters1") into PRINT PREVIEW format. From here, the user can choose what they want to do i.e. they can click on the "x" or File Close/Exit, and I want not only the print preview to close but the merged doc, e.g. Letters2 and then the template, BUT I cannot seem to reference this merged document as its name isnt always consistent. I am able to get the doc in print preview format, and close the template but as the macro is in the template I cannot close it, but am awaiting the user to click on File Exit, and once they do that everything will close, with NO CHANGES, i.e. the SAVE AS dialogue box shouldnt appear! I hope someone can help! Thanx alot! Preet x --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Document Merge Issues | Barb Reinhardt | General Discussion | 1 | October 13th, 2004 10:59 AM |
Enabling menu commands after protecting a document | tdtoolman | General Discussion | 3 | July 6th, 2004 07:21 PM |
Word hangs saving new document after merge to access database | Sandy | Mailmerge | 4 | May 19th, 2004 03:43 PM |
Blank Lines Not Supressing in Merged Document | Barbara | Mailmerge | 1 | May 11th, 2004 01:26 AM |