condition-based merging

J

Joost

Hi,

I'm constructing a collection of word-doc's that act as template for
new document creation (dûh). Regrettably we're bound to use a weird
and crappy control-application that determines the creation of the
files etc. (It should act like a database but doesn't deliver
variables.)

We have a collection of word-documents (all 2003) of which one acts as
the variabele provider, it's a simple form that contains the
personalia of students. The other documents read the personalia-
document within a folder (directory) and populate a number of form-
elements according to the data in the personalia-doc. (Mostly copying
name, date of birth etc. sometimes giving variable-based options in
lists.) The reading of data, copying and doing the other stuff is
nicely covered by some macro's (to solve the absolute/relative
filename issue and autoupdate all fields) and some simple merging
(inlcudetext).

It works like a charm on our crappy control-application (that just
copies 'template'-documents to specific folders) but all merged data
get lost the moment we isolate a document. All includetext-fields get
a nice 'file not found' entry. So, what I look for, a macro that does
the following:

- checks if a certain file (personalia) is there
- if it's there: copy data from specific form-elements (source-doc) to
specific form-elements (target-doc)
- when it's not: contain the data copied earlier

The solution I tried: setting a boolean docvariable with a 'detect
file' function and using it while parsing the field-codes. Fields
would be something like {if {docproperty docisthere}
="true" {includetext {docproperty personalia} name \!}}; it just gives
blanks when the docisthere-variable is false. The most elegant
solution is (imho) dropping the includetext stuff and using docprops
all the way but I can't get it to work...

Somewhere should be someone with an elegant and simple solution; to
that person: 'Help!'.

-Joost
 
M

macropod

Hi Joost,

Perhaps the easiest way is to:
1. first turn off the 'automatically update links at open' property (you can do this in code);
2. open the file with the INCLUDETEXT fields;
3. test for the existence of the file referred to by each INCLUDETEXT field;
4. unlink any INCLUDETEXT fields for which the source file is missing; and, optionally
5. update INCLUDETEXT fields for which the source file is found.

--
Cheers
macropod
[Microsoft MVP - Word]


Hi,

I'm constructing a collection of word-doc's that act as template for
new document creation (dûh). Regrettably we're bound to use a weird
and crappy control-application that determines the creation of the
files etc. (It should act like a database but doesn't deliver
variables.)

We have a collection of word-documents (all 2003) of which one acts as
the variabele provider, it's a simple form that contains the
personalia of students. The other documents read the personalia-
document within a folder (directory) and populate a number of form-
elements according to the data in the personalia-doc. (Mostly copying
name, date of birth etc. sometimes giving variable-based options in
lists.) The reading of data, copying and doing the other stuff is
nicely covered by some macro's (to solve the absolute/relative
filename issue and autoupdate all fields) and some simple merging
(inlcudetext).

It works like a charm on our crappy control-application (that just
copies 'template'-documents to specific folders) but all merged data
get lost the moment we isolate a document. All includetext-fields get
a nice 'file not found' entry. So, what I look for, a macro that does
the following:

- checks if a certain file (personalia) is there
- if it's there: copy data from specific form-elements (source-doc) to
specific form-elements (target-doc)
- when it's not: contain the data copied earlier

The solution I tried: setting a boolean docvariable with a 'detect
file' function and using it while parsing the field-codes. Fields
would be something like {if {docproperty docisthere}
="true" {includetext {docproperty personalia} name \!}}; it just gives
blanks when the docisthere-variable is false. The most elegant
solution is (imho) dropping the includetext stuff and using docprops
all the way but I can't get it to work...

Somewhere should be someone with an elegant and simple solution; to
that person: 'Help!'.

-Joost
 

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