PDA

Click to See Complete Forum and Search --> : Automatic Word Document/Mail Merge ??


VB_Novice
Apr 4th, 2000, 03:56 AM
Hello again,

I am using VB 5 as an interface to a database to record details of employees attending work. If they have bad attendance I would like to be able to automatically genertate a standard word document which would be sent to them using their address, which is stored in the Employee DB table.

I have Microsoft Word as a word processing package and I was wondering how I would go about trying to accomplish this task and what sort of coding would be necessary.

I hope someone can help.
Thanks,
Andy...........

Bigley
Apr 5th, 2000, 05:04 AM
I'm not sure about VB5 but I have used VB6 with an Access database to accomplish the task. There is a mailmerge option on the tool bar in Access it has the Word icon, if you click on this the rest of the operation is fairly intuitive. If you are not using Access you can start Word and choose to view MailMerge toolbar and then select your datasource and insert fields wherever you want them on the document.

At the VB end I just used an OLE object and pointed it to my document and behind it's click event I put the line
Ole1.DoVerb this launches the document and then you simply need to click on the 'merge' option on the toolbar in Word so that it pulls back the most recent data from your database.