RE: [Openroad-users] Master/Detail records within a Word Mail Merge

7 views
Skip to first unread message

Paul White

unread,
Jan 26, 2006, 12:03:28 AM1/26/06
to Mackinder, Duncan, Gareth Edwards, <
We use word mailmerge for Purchase orders and Statements.

The approach for Statements is very easy, a single merge record includes
header and a fixed number of detail fields. About 100 fields per record
Eg
Header fields....., line1 fields...., line2 fields...., line10 fields
<CR>
Header fields....., line1 fields...., line2 fields...., line10 fields
<CR>
Header fields....., line1 fields...., line2 fields...., line10 fields
<CR>

It is a bit tedious pasting these into the word mailmerge doc but works
fine. Our statements have an embedded excel graph which displays a
rolling 12 month history summary. After the mailmerge document is
generated, a macro reads the history details from a separate file and
puts it into the excel object, the graph automatically displays
correctly. These statement batches are anywhere up to 1000 pages at a
time.


P.O.s are only one page at a time. The data has fixed header information
followed by an arbitrary number of detail lines. The template has
"field codes" placed strategically on the form eg <1>, <2> etc. The
macro reads from the text file and does a find/replace on the field
codes. Something like this:

' f is the field number
marker$ = "<" + WordBasic.[LTrim$](Str(f)) + ">"
WordBasic.EditFind Find:=marker$, Direction:=0, MatchCase:=0,
WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=1
If WordBasic.EditFindFound() Then
If Len(a_field$) = 0 Then
WordBasic.WW6_EditClear 'remove marker
Else
WordBasic.Insert a_field$ 'insert data field
End If

In the detail area, the codes are just <+> with a routine which cycles
through a variable number of detail lines

Paul


-----Original Message-----
From: openroad-us...@peerlessit.com
[mailto:openroad-us...@peerlessit.com] On Behalf Of Mackinder,
Duncan
Sent: Thursday, 26 January 2006 10:14 AM
To: Gareth Edwards; <
Subject: RE: [Openroad-users] Master/Detail records within a Word Mail
Merge

Gareth

I think I'd be looking at the new Word 2003 XML document formats - you
ought to be able to either write these directly or maybe use XSLT to
transform the student data into the required form. One useful source of
inspiration is Andrew Savikas' book 'Word Hacks' published by O'Reilly
http://www.oreilly.com/catalog/wordhks/index.html. I've done a very
quick scan of the table of contents of my copy but I don't see a hack
which is exactly this. However I've certainly found the ideas useful in
other cases where I've either had to extract information from Word, or
generate complex reports into Word.

Hope this helps

Duncan

-----Original Message-----
From: openroad-us...@peerlessit.com
[mailto:openroad-us...@peerlessit.com] On Behalf Of Gareth
Edwards
Sent: 25 January 2006 16:41
To: <
Subject: [Openroad-users] Master/Detail records within a Word Mail Merge

ORd 4.1SP3
Win 2000
Word 2000/2003

Hi All,

I'm stumped. Can't figure how to do this and no-one in the whole
university knows. So here goes...

We're performing a Word mail merge from within ORd. And we have a
document that is a master detail report - where there's a student, with
X qualifications. I just wanted to know if this is possible within word
and guildlines of how to achieve it. The data file used with the
template can be either format, as there's plenty of pre-processing going
on before the merge:-

Stu Num Forename Surname Subject Grade
12345 Peter Pan English A
12345 Peter Pan Maths B

OR

Stu Num Forename Surname Subject Grade
12345 Peter Pan English A
Maths B

OR another 'given' format if required.


I've tried google, microsoft mailing list etc etc. {Next Record} doesn't
do it. I'm sure there must be a way. Can anyone offer any advice? Thanks
in advance.

PS. A doddle in Report Writer, Ah. Good ol' report writer (.detail !!)

Cheers,
Gareth Edwards
=============
Paisley University
x.3748

Legal disclaimer
--------------------------

The information transmitted is the property of the University of Paisley
and is intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material. Statements and
opinions expressed in this e-mail may not represent those of the
company. Any review, retransmission, dissemination and other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender immediately and
delete the material from any computer.

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


_______________________________________________
Openroad-users mailing list
Openroa...@peerlessit.com
http://www.peerlessit.com/mailman/listinfo/openroad-users


_______________________________________________
Openroad-users mailing list
Openroa...@peerlessit.com
http://www.peerlessit.com/mailman/listinfo/openroad-users


_______________________________________________
Openroad-users mailing list
Openroa...@peerlessit.com
http://www.peerlessit.com/mailman/listinfo/openroad-users

Gareth Edwards

unread,
Jan 25, 2006, 11:41:09 AM1/25/06
to <

Mackinder, Duncan

unread,
Jan 25, 2006, 6:14:29 PM1/25/06
to Gareth Edwards, <
Gareth

I think I'd be looking at the new Word 2003 XML document formats - you
ought to be able to either write these directly or maybe use XSLT to
transform the student data into the required form. One useful source of
inspiration is Andrew Savikas' book 'Word Hacks' published by O'Reilly
http://www.oreilly.com/catalog/wordhks/index.html. I've done a very
quick scan of the table of contents of my copy but I don't see a hack
which is exactly this. However I've certainly found the ideas useful in
other cases where I've either had to extract information from Word, or
generate complex reports into Word.

Hope this helps

Duncan

-----Original Message-----
From: openroad-us...@peerlessit.com
[mailto:openroad-us...@peerlessit.com] On Behalf Of Gareth
Edwards
Sent: 25 January 2006 16:41
To: <
Subject: [Openroad-users] Master/Detail records within a Word Mail Merge

Reply all
Reply to author
Forward
0 new messages