Docproperty Docvariable or Mail Merge

B

Bill

If I wish to automate a word document (2003) and take data from an access
database via vba, When is the correct time to use a docproperty or a
docvariable or a mergefield switch in the word doc?
Which one is best for what purpose?
The doc will be used for autoquotes with fileds filled in via a database an
be automated via access.
Thanks advance
Bill
 
D

Doug Robbins - Word MVP

Mergefields will work quite well under most circumstances, but cannot handle
the sort of situation where you need to create invoices for multiple
addressees where for each addressee there are multiple items to be included
on the one invoice.

In those circumstances I would use a roll-your-own equivalent to mailmerge
that used a template containing Docvariable fields in place of merge fields
and use code to iterate through the data source, creating a new document
from the template for each addressee and populating the variables with the
data for that addressee and builds a table in the document to contain the
invoice items for that addressee.

Otherwise, as you are wanting to automate this from Access, I suggest that
you take a look at the information referred to in the following post from
fellow MVP, Albert Kallal.

Quote

Actually, use my merge sample. it don't give that warning, and you don't
have to change registiry stuff etc.

The sample I have can be found here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

What is nice/interesting about my sample is that is specially designed to
enable ANY form with ONE LINE of code....

Thus, each time you build a new form, you can word merge enable it with
great ease.

Make sure you read the instructions from above, and you should eventually
get to the follwoing page
http://www.members.shaw.ca/AlbertKallal/wordmerge/page2.html


Note that the merge can also use a query, and thus you don't have to merge
just "one" record..

After the merge occurs, you get a plain document WITHOUT any merge fields,
and this allows the end user to save, edit, or even email the document
(since the merge fields are gone after the merge occurs).

Give the above a try.

Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
Unquote

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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