merge instructions from text file

S

Steve

This is an interesting assignment:

I need to feed information to Word 2000 telling it to merge given files with
given data, producing given output. I figure I would append instructions to a
text file, then have a Word macro periodically look at the text file, and, if
instructions were found, perform a merge. The text file would look something
like this:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf
c:\templatedir\document2.doc,c:\custdir\data.txt,c:\custdir\output2.rtf

So, the macro would merge document1.doc with data.txt and write output1.rtf,
and continue to the next record, etc.

I'm not a VB programmer, does this look doable?
 
G

Graham Mayor

What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could split
that file later into separate documents, but it would always start as a
single file. Whether what you propose is doable or not depends on exactly
what it is you are proposing and you have provided insufficient information
about the project to form an opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Steve

The text file example provided IS the instruction. Each record contains three
filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve
 
G

Graham Mayor

Your further response creates more questions than answers I'm afraid.

Am I to take it that document1.doc is a merge document containing fields
represented in data.txt, and that data.txt will contain a single record and
that custdir will change according to the customer? Thus you are intending
to run a lot of individual merges?

No guarantees that it will take us any farther, but can you tell us a lot
more about what you are doing and the documents involved.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

The text file example provided IS the instruction. Each record
contains three filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve



Graham Mayor said:
What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could
split that file later into separate documents, but it would always
start as a single file. Whether what you propose is doable or not
depends on exactly what it is you are proposing and you have
provided insufficient information about the project to form an
opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Steve

Ok, yes I was trying to keep the question simple. I need to build a
"contiinuous merge process" that runs 24x7 on a server. Using a database
application, individuals will perform data-entry on their own client
computers. Web users will also submit data. Once a client has completed
data-entry, the database application will create one delimited ASCII data.txt
containing results of the data-entry and place it a customer folder, for
example c:\customerA\data.txt. Each customer has a unique folder name.

The database application will then need to merge somewhere between one and a
dozen documents with the data.txt merge file. For example, DocumentA.doc,
DocumentB.doc, DocumentC.doc. Each will merge with the c:\customerA\data.txt.

The above would require three merge runs, each writing an individual
document in RTF format, written to the customerA folder. So, in this senerio,
the "instruction file" would contain three records as I have described
earlier.

---- I have just discovered that MS Word 2000 allows a maximum of 255 merge
fields in a data source. That may render this question moot. My merge file
has over 700 fields. -----

Steve

-----------------------------------------------------

Graham Mayor said:
Your further response creates more questions than answers I'm afraid.

Am I to take it that document1.doc is a merge document containing fields
represented in data.txt, and that data.txt will contain a single record and
that custdir will change according to the customer? Thus you are intending
to run a lot of individual merges?

No guarantees that it will take us any farther, but can you tell us a lot
more about what you are doing and the documents involved.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

The text file example provided IS the instruction. Each record
contains three filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve



Graham Mayor said:
What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could
split that file later into separate documents, but it would always
start as a single file. Whether what you propose is doable or not
depends on exactly what it is you are proposing and you have
provided insufficient information about the project to form an
opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
This is an interesting assignment:

I need to feed information to Word 2000 telling it to merge given
files with given data, producing given output. I figure I would
append instructions to a text file, then have a Word macro
periodically look at the text file, and, if instructions were found,
perform a merge. The text file would look something like this:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf
c:\templatedir\document2.doc,c:\custdir\data.txt,c:\custdir\output2.rtf

So, the macro would merge document1.doc with data.txt and write
output1.rtf, and continue to the next record, etc.

I'm not a VB programmer, does this look doable?
 
M

macropod

Hi Steve,

This doesn't sound like a mailmerge at all, at least not in the sense that
Word uses the term. Having said that, and depending on what's in your source
file and where it does in the target file, that may necessitate the use of a
mailmerge approach.

What you're describing is, superficially at least, a linked document. In
this case, your c:\templatedir\document1.doc is the target and
c:\custdir\data.txt is the source. Linking would work well if your source
document contains a text string or a list that needs to be inserted as a job
lot into one location in the target document. If you create one of your
source files, and a 'test' file for use as a target document, use Word's
Insert|File tools from the menu to insert the text file as a link. This will
import the contents of the text file into your Word document. Next, change
the source file then press F9 in Word, and you'll see that the Word document
updates to reflect the changes. See INCLUDETEXT in Word's Help file for
more info. If you want to save the file to rtf, with the link 'locked' to
prevent further changes, simply select ihe inserted material and press
Ctrl-Shift-F9 before saving. This process would be quite easy to automate.

However, if your source file has fields that need to be inserted into
different places in your target document, a mailmerge approach would
probably work better. In that case, you'd need your text files to have a
consistent, delimited structure; otherwise you wouldn't be able to control
which fields went where in the Word document. If, for example, some fields
are sometimes empty, the empty fields would still have to be included in the
text file - you couldn't simply leave them out and expect Word to work out
what's happened. provided you do that, this process would also be quite easy
to automate.

Cheers


Steve said:
Ok, yes I was trying to keep the question simple. I need to build a
"contiinuous merge process" that runs 24x7 on a server. Using a database
application, individuals will perform data-entry on their own client
computers. Web users will also submit data. Once a client has completed
data-entry, the database application will create one delimited ASCII data.txt
containing results of the data-entry and place it a customer folder, for
example c:\customerA\data.txt. Each customer has a unique folder name.

The database application will then need to merge somewhere between one and a
dozen documents with the data.txt merge file. For example, DocumentA.doc,
DocumentB.doc, DocumentC.doc. Each will merge with the c:\customerA\data.txt.

The above would require three merge runs, each writing an individual
document in RTF format, written to the customerA folder. So, in this senerio,
the "instruction file" would contain three records as I have described
earlier.

---- I have just discovered that MS Word 2000 allows a maximum of 255 merge
fields in a data source. That may render this question moot. My merge file
has over 700 fields. -----

Steve

-----------------------------------------------------

Graham Mayor said:
Your further response creates more questions than answers I'm afraid.

Am I to take it that document1.doc is a merge document containing fields
represented in data.txt, and that data.txt will contain a single record and
that custdir will change according to the customer? Thus you are intending
to run a lot of individual merges?

No guarantees that it will take us any farther, but can you tell us a lot
more about what you are doing and the documents involved.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

The text file example provided IS the instruction. Each record
contains three filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve



:

What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could
split that file later into separate documents, but it would always
start as a single file. Whether what you propose is doable or not
depends on exactly what it is you are proposing and you have
provided insufficient information about the project to form an
opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
This is an interesting assignment:

I need to feed information to Word 2000 telling it to merge given
files with given data, producing given output. I figure I would
append instructions to a text file, then have a Word macro
periodically look at the text file, and, if instructions were found,
perform a merge. The text file would look something like this:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf
c:\templatedir\document2.doc,c:\custdir\data.txt,c:\custdir\output2.rtf

So, the macro would merge document1.doc with data.txt and write
output1.rtf, and continue to the next record, etc.

I'm not a VB programmer, does this look doable?
 
S

Steve

Thanks, but I have to merge in hundreds of pieces of text and variables, so a
merege is required. Also, I find out that Word only allows 255 fields in a
merge data source (at least that was where it cut off when I tried to merge
my 500+ field data source). So I can't use Word at all for this process. I
have to use Word Perfect which has no such limits).

Steve
----------------

macropod said:
Hi Steve,

This doesn't sound like a mailmerge at all, at least not in the sense that
Word uses the term. Having said that, and depending on what's in your source
file and where it does in the target file, that may necessitate the use of a
mailmerge approach.

What you're describing is, superficially at least, a linked document. In
this case, your c:\templatedir\document1.doc is the target and
c:\custdir\data.txt is the source. Linking would work well if your source
document contains a text string or a list that needs to be inserted as a job
lot into one location in the target document. If you create one of your
source files, and a 'test' file for use as a target document, use Word's
Insert|File tools from the menu to insert the text file as a link. This will
import the contents of the text file into your Word document. Next, change
the source file then press F9 in Word, and you'll see that the Word document
updates to reflect the changes. See INCLUDETEXT in Word's Help file for
more info. If you want to save the file to rtf, with the link 'locked' to
prevent further changes, simply select ihe inserted material and press
Ctrl-Shift-F9 before saving. This process would be quite easy to automate.

However, if your source file has fields that need to be inserted into
different places in your target document, a mailmerge approach would
probably work better. In that case, you'd need your text files to have a
consistent, delimited structure; otherwise you wouldn't be able to control
which fields went where in the Word document. If, for example, some fields
are sometimes empty, the empty fields would still have to be included in the
text file - you couldn't simply leave them out and expect Word to work out
what's happened. provided you do that, this process would also be quite easy
to automate.

Cheers


Steve said:
Ok, yes I was trying to keep the question simple. I need to build a
"contiinuous merge process" that runs 24x7 on a server. Using a database
application, individuals will perform data-entry on their own client
computers. Web users will also submit data. Once a client has completed
data-entry, the database application will create one delimited ASCII data.txt
containing results of the data-entry and place it a customer folder, for
example c:\customerA\data.txt. Each customer has a unique folder name.

The database application will then need to merge somewhere between one and a
dozen documents with the data.txt merge file. For example, DocumentA.doc,
DocumentB.doc, DocumentC.doc. Each will merge with the c:\customerA\data.txt.

The above would require three merge runs, each writing an individual
document in RTF format, written to the customerA folder. So, in this senerio,
the "instruction file" would contain three records as I have described
earlier.

---- I have just discovered that MS Word 2000 allows a maximum of 255 merge
fields in a data source. That may render this question moot. My merge file
has over 700 fields. -----

Steve

-----------------------------------------------------

Graham Mayor said:
Your further response creates more questions than answers I'm afraid.

Am I to take it that document1.doc is a merge document containing fields
represented in data.txt, and that data.txt will contain a single record and
that custdir will change according to the customer? Thus you are intending
to run a lot of individual merges?

No guarantees that it will take us any farther, but can you tell us a lot
more about what you are doing and the documents involved.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
The text file example provided IS the instruction. Each record
contains three filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve



:

What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could
split that file later into separate documents, but it would always
start as a single file. Whether what you propose is doable or not
depends on exactly what it is you are proposing and you have
provided insufficient information about the project to form an
opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
This is an interesting assignment:

I need to feed information to Word 2000 telling it to merge given
files with given data, producing given output. I figure I would
append instructions to a text file, then have a Word macro
periodically look at the text file, and, if instructions were found,
perform a merge. The text file would look something like this:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf
c:\templatedir\document2.doc,c:\custdir\data.txt,c:\custdir\output2.rtf

So, the macro would merge document1.doc with data.txt and write
output1.rtf, and continue to the next record, etc.

I'm not a VB programmer, does this look doable?
 
M

macropod

500+ fields per customer?


Steve said:
Thanks, but I have to merge in hundreds of pieces of text and variables, so a
merege is required. Also, I find out that Word only allows 255 fields in a
merge data source (at least that was where it cut off when I tried to merge
my 500+ field data source). So I can't use Word at all for this process. I
have to use Word Perfect which has no such limits).

Steve
----------------

macropod said:
Hi Steve,

This doesn't sound like a mailmerge at all, at least not in the sense that
Word uses the term. Having said that, and depending on what's in your source
file and where it does in the target file, that may necessitate the use of a
mailmerge approach.

What you're describing is, superficially at least, a linked document. In
this case, your c:\templatedir\document1.doc is the target and
c:\custdir\data.txt is the source. Linking would work well if your source
document contains a text string or a list that needs to be inserted as a job
lot into one location in the target document. If you create one of your
source files, and a 'test' file for use as a target document, use Word's
Insert|File tools from the menu to insert the text file as a link. This will
import the contents of the text file into your Word document. Next, change
the source file then press F9 in Word, and you'll see that the Word document
updates to reflect the changes. See INCLUDETEXT in Word's Help file for
more info. If you want to save the file to rtf, with the link 'locked' to
prevent further changes, simply select ihe inserted material and press
Ctrl-Shift-F9 before saving. This process would be quite easy to automate.

However, if your source file has fields that need to be inserted into
different places in your target document, a mailmerge approach would
probably work better. In that case, you'd need your text files to have a
consistent, delimited structure; otherwise you wouldn't be able to control
which fields went where in the Word document. If, for example, some fields
are sometimes empty, the empty fields would still have to be included in the
text file - you couldn't simply leave them out and expect Word to work out
what's happened. provided you do that, this process would also be quite easy
to automate.

Cheers


Steve said:
Ok, yes I was trying to keep the question simple. I need to build a
"contiinuous merge process" that runs 24x7 on a server. Using a database
application, individuals will perform data-entry on their own client
computers. Web users will also submit data. Once a client has completed
data-entry, the database application will create one delimited ASCII data.txt
containing results of the data-entry and place it a customer folder, for
example c:\customerA\data.txt. Each customer has a unique folder name.

The database application will then need to merge somewhere between one
and
a
dozen documents with the data.txt merge file. For example, DocumentA.doc,
DocumentB.doc, DocumentC.doc. Each will merge with the c:\customerA\data.txt.

The above would require three merge runs, each writing an individual
document in RTF format, written to the customerA folder. So, in this senerio,
the "instruction file" would contain three records as I have described
earlier.

---- I have just discovered that MS Word 2000 allows a maximum of 255 merge
fields in a data source. That may render this question moot. My merge file
has over 700 fields. -----

Steve

-----------------------------------------------------

:

Your further response creates more questions than answers I'm afraid.

Am I to take it that document1.doc is a merge document containing fields
represented in data.txt, and that data.txt will contain a single
record
and
that custdir will change according to the customer? Thus you are intending
to run a lot of individual merges?

No guarantees that it will take us any farther, but can you tell us
a
lot
more about what you are doing and the documents involved.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
The text file example provided IS the instruction. Each record
contains three filenames. For example, the first record:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtf

says merge [data.txt] with [document1.doc] and write [output1.rtf]

Steve



:

What 'instructions' do you propose adding to the text file that would
trigger the need to re-merge? Is this text file the data file?
A word merge will write all its output to a single file - you could
split that file later into separate documents, but it would always
start as a single file. Whether what you propose is doable or not
depends on exactly what it is you are proposing and you have
provided insufficient information about the project to form an
opinion.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Steve wrote:
This is an interesting assignment:

I need to feed information to Word 2000 telling it to merge given
files with given data, producing given output. I figure I would
append instructions to a text file, then have a Word macro
periodically look at the text file, and, if instructions were found,
perform a merge. The text file would look something like this:

c:\templatedir\document1.doc,c:\custdir\data.txt,c:\custdir\output1.rtfc:\templatedir\document2.doc,c:\custdir\data.txt,c:\custdir\output2.rtf

So, the macro would merge document1.doc with data.txt and write
output1.rtf, and continue to the next record, etc.

I'm not a VB programmer, does this look doable?
 
S

Steve

Yes, although I suppose its possible to break the one file into several
smaller data source files. They are legal documents and the bulk of the
fields contain names, addresses, relationships of persons named in the
document. I could probably normalize this a bit. I still am suprised Word
limits the data source to 255; I expect that is because it holds the values
in an array so it can show the "merged" documents directly in the Main
Document prior to performing the actual merge process to a final document.
 

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