Writing from Oracle Database to Word

B

BritInWI

Hi all,

Please forgive me if there's an obvious answer to this question,
but I'm a newbie to both Windows development and VB (I live
in a mostly Java world).

We've got an Oracle database, and we want to write some
selected data to a Word document. Our thought was that
perhaps we could use VBA or VBScript to do this, or find
a third party tool to do this for us.

Does anyone have advice on the best and/or easiest way to
perform such a task?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?QnJpdEluV0k=?=,
We've got an Oracle database, and we want to write some
selected data to a Word document. Our thought was that
perhaps we could use VBA or VBScript to do this, or find
a third party tool to do this for us.

Does anyone have advice on the best and/or easiest way to
perform such a task?
It can certainly be done, although I can't give you any
programming code snippets.

You'd need to use ADO to link to the Oracle data (that's
Microsoft ActiveX Data objects library, to which you'd need
to set a reference in the project (Tools/References)). ADO
sets up the connection and retrieves the recordset. You
should be able to get more information on this in a
newsgroup like data.ado or an Oracle-specific group.

On the Word end, one traditionally creates bookmark targets
in the document (Insert/Bookmark) and puts the data into
that. Roughly:
Dim doc as Word.Document
Set doc = ActiveDocument 'or Documents.Open or
Documents.Add
doc.Bookmarks("Name").Range.Text =
rs.Fields("Name").Value

Depending on what you really need to do, Mail Merge might
also be an option for you.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
B

BritInWI

Cindy M -WordMVP- said:
You'd need to use ADO to link to the Oracle data (that's
Microsoft ActiveX Data objects library, to which you'd need
to set a reference in the project (Tools/References)). ADO
sets up the connection and retrieves the recordset. You
should be able to get more information on this in a
newsgroup like data.ado or an Oracle-specific group.

On the Word end, one traditionally creates bookmark targets
in the document (Insert/Bookmark) and puts the data into
that. Roughly:
Dim doc as Word.Document
Set doc = ActiveDocument 'or Documents.Open or
Documents.Add
doc.Bookmarks("Name").Range.Text =
rs.Fields("Name").Value

Depending on what you really need to do, Mail Merge might
also be an option for you.

Hi Cindy,

Thanks for the advice. Yes, I believe Mail Merge would be appropriate.
We need to create a customized cover letter, append some data and
then print the document.

- Jack
 

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