Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically starting Word Merge Wizard

Status
Not open for further replies.

FredaH302

MIS
Dec 15, 2006
22
US
Hi Everyone,

I have a form that uses a button to run a query that creates table for use in a Word merged document. The query is triggered using VBA code. After the query is run, the code selects the resulting table and then starts the Mail Merge Wizard (Office Links: Merge it with MS Word).

The problem is that in order to select the table, the Main window must be visible. I have the code hide the window once the wizard has been initiated, but this seems awkward.

Does anyone know of a way to start the Wizard and attach the appropriate table without exposing the main window?

By the way, here is a sample of the code I am using:

If [ERSelector] = 4 Then
DoCmd.OpenQuery "aWordMerge_OAA_Locations", acViewNormal
DoCmd.SelectObject acTable, "WordMerge_Contacts", True
GoTo Complete_Merge:

Complete_Merge:
DoCmd.RunCommand acCmdWordMailMerge
DoCmd.RunCommand acCmdWindowHide


Note: ERSelector is just a List box with several entries within it. The one chosen determines the query to run.

Thanks
 
You can Run a Mail Merge from Access, but you will have to use OLE automation by referencing the Word Object Model from your Access VBA Code
 
Are you talking about referencing the Main document in Word that attaches to the data source?

If possible, I would like to allow my users to call upon the Merge Wizard from within Access in order to give them the option of creating a new document or attaching to an existing one.

Basically, I don't want the dbase Main Window to show while the table is being selected. The only way I have found to do this is to resize the Main window as small as it can be and place it behind the Switchboard form I created.

The user doesn't see the window, but I was hoping for a more elegant solution.
 
You can Run the Mail Merge via OLE and have your users supply parameters. I do not think you can show the Word Mail Merge Wizard Form from within Access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top