View Single Post
  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Repeat the fields

You'll need a macro in this case - I suggest you look at

http://msdn.microsoft.com/en-us/library/cc793964.aspx

which has some examples with instructions on how to adapt the code for
various situations. If you need help with that, post back. However, if
you need to do that I could use some clarification about the format of
your worksheets.

I'm told to do something and I have to do
it whether I like the way it is done or not .


I'm familiar with that set-up.

Yes, each file is exactly the same, except for the information under
the headers. In actuality, I have a header row for which each of that
row's cell's column contains information from the spreadsheet. For
example:
Row 1 = "1"....."98"
Row 2 = B8....B98
Col A = Header column for col B


I didn't really understand the details you have here and wonder if there
is a typo. Perhaps an example that shows what the first 5 rows of one of
the sheets looks like would help.

I'm not sure what you mean by my data source
running out of records


What I meant was this - your example of the output shows 6 records, each
one from a different workbook. To simplify, suppose you have 3 workbooks
A,B, and C with 8, 6 and 4 records respectively. If "A1" means the first
row of data in workbook A, should the output be in this sequence:

A1
B1
C1
A2
B2
C2
A3
B3
C3
A4
B4
C4
A5
B5
A6
B6
A7
A8

or what (it could be for example that you needs blocks of three like this

A1
B1
C1

A2
B2
C2

A3
B3
C3

A4
B4
C4

A5
B5
empty row

A6
B6
empty row

A7
empty row
empty row

A8
empty row
empty row

)


Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Nit_Wit_400 wrote:
Mr. Jamieson,

Are your separate databases in separate workbooks, or are they in the
same workbook but in different worksheets?


Yes, my data is in separate excel spreadsheets.

Does each database have the same column names and sequence of columns
/in the data source/ ?


Yes, each file is exactly the same, except for the information under
the headers. In actuality, I have a header row for which each of that
row's cell's column contains information from the spreadsheet. For
example:
Row 1 = "1"....."98"
Row 2 = B8....B98
Col A = Header column for col B

It is done this way so that the word document says F1 instead of
Client Name .. can't say I like it, but that's the way chain of
command works around here. I'm told to do something and I have to do
it whether I like the way it is done or not .

What sequence of records do you need in your output document (i.e. do
you need the first record from each data source, followed by the second
record from each data source, etc. When one data source runs out of
records, do you any kind of placeholder or do you just want to continue
with the next available record?


Each spreadsheet has the data for each client, however, in the Word
document, we need to combine the information into one. Ideally, it
needs to handle X amount of input and it needs to be in the format
from my last posting. I'm not sure what you mean by my data source
running out of records because the mergefield wouldn't be there if
there wasn't going to be information to put in it, but I guess if for
some reason the cell was erroneously empty, an error message should
appear. However, I guess in some cases, there would be an instance
when there was no information given to us about the cell's required
information. In this case, it should either be skipped, or if it is
purposely empty, it usually means that a whole section of the word
document should be eliminated.