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 / December 2005

Tip: Looking for answers? Try searching our database.

Allow user to rerun merge using different parameter criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kheisler6@cox.net - 18 Dec 2005 21:57 GMT
When I open a Word document, an AutoOpen Macro automatically connects
to a parameter query in an Access database, prompts the user for a Last
Name, and then executes the merge. Both the original merge template and
the final merged document stay open.

How can I let the user return to the original merge template and rerun
the merge (maybe with a keystroke combination), this time entering a
different Last Name at the prompt?

Thank you. Code below.

Kurt

###

Sub AutoOpen()

   'Start a new main document for the mail merge.

   With MainDoc.MailMerge

       .MainDocumentType = wdCatalog
       .OpenDataSource Name:="G:\Work\PM\PM.mdb", _
           Connection:= _
               "QUERY qryManuscripts", _
           SQLStatement:= _
               "SELECT * FROM [qryManuscripts]", _
           SQLStatement1:="", _
           SubType:=wdMergeSubTypeWord2000
   
   End With
       
MainDoc.MailMerge.Execute
macropod - 19 Dec 2005 12:01 GMT
Hi Kurt,

If you press Alt-F8 after returning to the original merge document, you
should be able to select and re-run the AutoOpen macro (unless it's been
hidden).

You could automate the process by adding a MACROBUTTON field to the original
merge document, coded as:
{MACROBUTTON AutoOpen Run Again}
where the field braces (ie '{}') are created as a pair via Ctrl-F9. If you
then format the field's font as hidden text and make sure the 'hidden text'
option is unchecked under Tools|Options|Print, that should complete the
task.

Cheers

> When I open a Word document, an AutoOpen Macro automatically connects
> to a parameter query in an Access database, prompts the user for a Last
[quoted text clipped - 29 lines]
>
> MainDoc.MailMerge.Execute
 
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.