Mail merge to Ms Word 
Author Message
 Mail merge to Ms Word

Hi All
        We are useing VB6 & Word 2000. What we want to do is to merge names
and address in to a document template. We can call the word object and open
a specific .doc, what we cant do is figure out how to merge the contents of
the various tables fields values i.e Mr   John  Doe etc... in to the header
of the document.

Any help on how to complete this task or a pointer in the right direction
would be greatley appreciated

David O`Brien....



Wed, 19 Jun 2002 03:00:00 GMT  
 Mail merge to Ms Word
Hi David:

I'm not sure about VB6 and Word 2000, but with VB5 and Word 97 it's not too
tough.  First you have to be sure that when you installed Word, that you were
certain to install the option to import from MS Access (mdb) databases.  If
not, you can go into MSWord setup and re-install that portion.

Then, from inside an MSWord document, you can choose tools, and choose mail
merge.  Once you've created the template document, you can choose the "Get
Data" option on the mail merge.  Then choose Open Data Source.

In the bottom left hand corner of that window should be something that says
"files of type" and it will have a pull down menu.  Pull down the menu and it
should have an option (if you did the appropriate install mentioned above) that
says MS Access Databases.  Once you've selected that, simply browse until you
find your database and merge away.

Hope this helps!

Dale


Quote:

>Hi All
>        We are useing VB6 & Word 2000. What we want to do is to merge names
>and address in to a document template. We can call the word object and open
>a specific .doc, what we cant do is figure out how to merge the contents of
>the various tables fields values i.e Mr   John  Doe etc... in to the header
>of the document.

>Any help on how to complete this task or a pointer in the right direction
>would be greatley appreciated

>David O`Brien....



Thu, 20 Jun 2002 03:00:00 GMT  
 Mail merge to Ms Word
Hi,

I am grappling with the exact same thing.  I do, however, have the
thing successfully merging, so here's what I've done so far:

In my case, the names and addresses are in a SQL Server database.  I
get the recordset with ADO and write it to an Access database using
DAO.  (There's probably a more efficient way to do this, but since I
already know how to merge a Word doc with an Access db, I did it this
way.)

Create the primary merge file in Word.

In VB, set a reference to Word 9.0 objects.

Dim objWord as word.document
set objWord = GetObject("filepath\primarymerge.doc", "Word.Document")
objWord.application.visible= true (so you can see what's going on)
objWord.MailMerge.OpenDataSource _
  Name:="filepath\databasename.mdb", _
  LinkToSource = true _
  Connection:= "TABLE tablename", _
  SQLStatement:= "Select * from [tablename]"

objWord.MailMerge.Execute

This works like a charm.  What I now can't figure out is how to save
the newly created merged file.  If you have any idea how to do that,
please enlighten me.

I hope this helps.

Liz


Quote:
> Hi All
>         We are useing VB6 & Word 2000. What we want to do is to merge
names
> and address in to a document template. We can call the word object
and open
> a specific .doc, what we cant do is figure out how to merge the
contents of
> the various tables fields values i.e Mr   John  Doe etc... in to the
header
> of the document.

> Any help on how to complete this task or a pointer in the right
direction
> would be greatley appreciated

> David O`Brien....

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 28 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Mail Merge in MS Word?

2. mail-merge MS Word and MS Access via ASP

3. Word Mail Merge Err - Word could not merge...

4. From VB6, call a MS WORD Mail-Merge feature

5. Word Mail merge field TO MS Access???

6. VB to MS Word Mail merge functionallity

7. Mail Merge: MS-Word/Access

8. MS Word 97 Mail Merge with Oracle Datasource?

9. SLOW MS Word Mail Merge with VB5

10. MS-Word mail merge

11. OLE Control and MS Word Mail Merge

12. MS Word 97 Mail Merge with Oracle Datasource?

 

 
Powered by phpBB® Forum Software