Sending Tbl to Word using VB coding Public Sub DatabaseXFer() & Public Function CreateWordObj()

A

Andy

Hi;

Been trying to merge multiple names to Word.

Found this possible answer "SENDING DATA BASE RECORDS TO MS-WORD USING VB
CODING".

At:
http://en.allexperts.com/q/Visual-Basic-1048/SENDING-DATA-BASE-RECORDS.htm

But it doesn't tell You how to use it. How is it triggered?

Step 1. Set a reference To Microsoft ActiveX Data objects 2.x (Necessary in
BOTH Word AND VB)

Go To Project, References On the menu. x should be at least 5 Or greater..If
Not GoTo Microsoft.com And search For MDAC And update!

Step 2. Set a Reference to Microsoft Word Object (Only necessary in VB)

Then use this code In a MODULE!:

Public gobjWord As Word.Application

Public Sub DatabaseXFer()

Public Function CreateWordObj() As Boolean

Would someone be so kind and point me in the right direction?

Thank You for taking the time to read this Post.

Andy
 
C

Clifford Bass

Hi Andy,

I have not used it. But I can make a guess. First create a new module
and copy the entire code into the module. Then modify the 'strSQL = "SELECT
* from Table1"' line to pull the data you want. Then create a button on a
form and create an on click event procedure for the button. Place
DatabaseXFer on a line in the event procedure. Or you can create a macro
that calls DatabaseXFer. If you do that, you will also need to change it
from a Sub to a Function.

Hope that helps,

Clifford Bass
 
A

Andy

Clifford;

Thank You.

Trying it now.

Andy

Clifford Bass said:
Hi Andy,

I have not used it. But I can make a guess. First create a new
module
and copy the entire code into the module. Then modify the 'strSQL =
"SELECT
* from Table1"' line to pull the data you want. Then create a button on a
form and create an on click event procedure for the button. Place
DatabaseXFer on a line in the event procedure. Or you can create a macro
that calls DatabaseXFer. If you do that, you will also need to change it
from a Sub to a Function.

Hope that helps,

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top