plugging data into a word document

W

Woody

i programmatically pull data from access and shove it into
a word document.

I have been using search and replace to do this but teh
search object seems a bit weird when using wild card.

I have heard there is a better method but i have no idea
what it is.

can anyone please tell me whatteh better method is and how
do i implement it?

Sincerely

Woody
 
H

Helmut Weber

Hi Woody,
there are many ways to do that. But besides that
the search object seems a bit weird when using
wild card.
is not a too clear description of the problem.
One way would be to use bookmarks and fill the
"bookmark.range.text"-property with values from
a database. Like:
ActiveDocument.Bookmarks("City").Range.Text = "Landsberg"
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, XP, NT4.0, W98
 
J

Jezebel

It depends on how much data and what sort. If you're talking about
individual fields of data (eg one record from a query) a good method is to
use CustomDocumentProperties. Within the document itself you insert
DocProperty fields wherever you want the data to appear (eg { DocProperty
"CustomerName" } ). Your VB app sets the property --
ActiveDocument.CustomDocumentProperties.Add (...) -- then updates fields.
Has the advantage that your code doesn't have to touch the content of the
document at all; and you can use the same method for any Office document
(Excel, Project, etc); also there's a free app from Microsoft that reads and
writes document properties without actually opening the document, useful if
you've got a lot of documents to work with. Tricky for graphics, though.

If you're dealing with bulk data (eg all records from a query) look at the
mailmerge methods.
 

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