Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2005

Tip: Looking for answers? Try searching our database.

merge instructions from text file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 24 Nov 2005 10:13 GMT
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?
Graham Mayor - 25 Nov 2005 08:09 GMT
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.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> This is an interesting assignment:
>
[quoted text clipped - 11 lines]
>
> I'm not a VB programmer, does this look doable?
Steve - 25 Nov 2005 09:34 GMT
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?
[quoted text clipped - 19 lines]
> >
> > I'm not a VB programmer, does this look doable?
Graham Mayor - 25 Nov 2005 13:54 GMT
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.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> The text file example provided IS the instruction. Each record
> contains three filenames. For example, the first record:
[quoted text clipped - 37 lines]
>>>
>>> I'm not a VB programmer, does this look doable?
Steve - 25 Nov 2005 17:41 GMT
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.
>
[quoted text clipped - 47 lines]
> >>>
> >>> I'm not a VB programmer, does this look doable?
macropod - 25 Nov 2005 21:30 GMT
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

> 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
[quoted text clipped - 33 lines]
> > > 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]
> > >
[quoted text clipped - 24 lines]
> > >>> 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?
Steve - 25 Nov 2005 21:55 GMT
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
----------------

> Hi Steve,
>
[quoted text clipped - 114 lines]
> > > >>>
> > > >>> I'm not a VB programmer, does this look doable?
macropod - 26 Nov 2005 01:41 GMT
500+ fields per customer?

> 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
[quoted text clipped - 123 lines]
> > > > >>>
> > > > >>> I'm not a VB programmer, does this look doable?
Steve - 26 Nov 2005 03:31 GMT
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.

> 500+ fields per customer?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.