Can I store e.g. formatted Word-text in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to generate a Word text based on selections made in my database. For
that it would be ideal if I could save a formatted Word-text-block in Access
and then just merge the block into my document....

Any suggestions or experiences on doing something like this?
 
There is no way that I know of. But you can access Word documents (read
and/or write) from within Access. It's a somewhat complex process though.

-Dorian
 
Hi Diane,

There's no simple way of doing this.

One approach is:

1) Set up a Word template with all the various blocks of formatted
text stored as Autotext entries. At points where you need to insert
values from database fields, put placeholders (e.g.
"<<CompanyName>>").

2) Write VBA code that runs in Access and
- creates a new document from the template
- inserts the Autotext entries in the right order
- uses Replace commands to substitute data values for the
placeholders.

Another is to store the formatted blocks in your database as XML and
write VBA code to create an XML document that Word can open.

The first approach might be easier to implement, but the second is
more flexible and future-proof.
 
The XML solution may be the way to go. Many years ago I worked in
"Bookmaster" - a structured languade to format text. Here the text could be
written in a plain text editor and then formatted to look rigth in by the
Bookmaster program. I expect the same to be possible with XML - and that it
can be generated from a program.

Are there any good examples somewhere on basic XML?
 
I don't know about online sources, but googling will find some. And
there are lots and lots of books. I have the Microsoft Press "XML Step
by Step" and the O'Reilly "XML Pocket Reference", but there must be
many more good ones.
 
Back
Top