Using an ADODB.Recordset in a MailMerge

T

Todd C

I have done Word merges to Access data two ways: One is to create a regular
Word Merge template and specify a datasource view or query that gets its data
from Access. (Fairly straightforward). THe other way is to create a Word
Template and set up Bookmarks in every place where a bit of merged data would
go, then in Access, 'push' the data into the Word template using VBA coding.
This works great for VERY fine control of what goes where, but is really only
useful for single records.

I am wondering if there is a way to use VBA code in Access to 'push' an
ADODB recordset object out and make it the recordsource for a Word Merge
document?

Basicaly, it would work like this:

Dim objWord as Word.Document
Dim MyRS as ADODB.Recordset

Set MyRS = ...

Set objWord = Get Object(...)
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource = ????? MyRS ????
( Will the above line work? )

objWord.MailMerge.Execute

Thanks in advance.

Todd C
 
Top