How do we read variables into a Word document?

L

Liza

Hi

Background:
---------------
We have an upcoming customer project for which we'll need to keep lots
of separate small(ish) Word documents edited by different users. Some
or all of these will at times need to be combined into one single
Final Document. The Final Document can be produced for Internal use or
for end-customer use and will need different headers/footers and fonts
in each case.

A database system will track which particular documents are required
for any Final Document. This system will output the ordered list of
filenames as variables in various ways - as a CSV list, or as separate
lines in a text file, or any way you recommend.

Requirement:
-----------------
I think we can deal with the need for different headers/fonts etc by
setting up several Templates with the right settings.

So what we then need is a macro (preferably run from outside Word)
which will:

* create a new document using a specified template
* Loop through the list of filename variables and do an Insert File
for each one.
* Save the document after all the files have been read in.

I am not a VB coder, and although I can of course record a Word macro
inserting specific files, I don't know how to approach this more
abstract requirement.

If anyone has code to do this, I would be very grateful to see it.

----------------
Also - is it possible to read variables into a Word Header in any
similar way? So that the values in the header can be populated from
data in the database.

Thanks in advance

Liza
 
H

Howard Kaikow

All macros must run from within an Office application, say, Word, but you
can hide that from the user by writing a VB program that silently invokes
Word.

The VB program could be started from, say, a shortcut on the desktop or in
the Office Shortcut Bar or on the Task Bar.

The particular code required has to be specific to your task, so you either
need to learn how to write macros or hire somebody to do it for you or to
guide you along the way.

One place to start is with a Word VBA book.
I have a list of Word VBA books at my URL below.
 

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