"Mail Merge" from VB to Word

I have an application that needs to publish results in MS Word in a "Mail Merge" type activity.  Insert fields in a template document which only outputs a selected recordset or single record.  Do I use the Shell command for this, or is there a way to publish a SQL statement that would accomplish this.  (This is easily performed in Access, is it similiar type commands?)

Database: MS Access 97

Application: VB 6.0

Details: Single form brings up a single record.  Send that record to an already made word document with insert fields that need data from the VB form.

Who is Participating?
tcurtinConnect With a Mentor Commented:
Hi JimBre,
Set the document up with bookmarks in strategic locations.
Set a reference to Word.
Dim oWord as Word.Application
Set oWord = new Word.Application
dim odoc as Document
Set oDoc = oWord.Documents.Open("c:\MyFormLetter.Doc")
with oDoc
    .Range.Bookmarks("CustomerName")= txtCustName.text
    'and so on.
    .Close False 'don't save
end with
You can set the visible property if you need to see it.

JimBreAuthor Commented:
Edited text of question.
JimBreAuthor Commented:
Appreciate the response.  It was clear and very easy to follow.

JimBreAuthor Commented:
I attempted the response that tcurtin gave, (and yes I was sure to add the appropriate references) and I get an "Invalid object" message when I attempt to run it.  It specifically highlights the ".Range.Bookmarks("Bookmark Name")= Control.Text"  Is there something I'm missing?  Is there a better way?  'Who invented liquid soap and why?'

Appreciate the help.
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

Thank you,
Moderator @ Experts Exchange
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.