View Single Post
  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to print double sided postcard using mail merge

I am not sure that the OP wanted the same fields for each record on both
sides of the card, which I think Peter's method cannot handle.

If the data source is a Word document and the Printer flips on the long edge
of the paper (usually the default) I believe that the following macro will
make the necessary modification to the datasource:

Dim i As Long, j As Long
Dim dtable As Table
Dim arec As Range
Set dtable = ActiveDocument.Tables(1)
i = (dtable.Rows.Count - 1) Mod 4
If i 0 Then
For j = 1 To 4 - 1
dtable.Rows.Add
Next j
End If
For i = dtable.Rows.Count - 3 To 5 Step -4
For j = 1 To 4
dtable.Rows.Add (dtable.Rows(i))
Next j
Next i
For j = 1 To 4
dtable.Rows.Add
Next j
For i = dtable.Rows.Count To 9 Step -8
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - 5, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i
For i = dtable.Rows.Count - 1 To 8 Step -8
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - 3, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i
For i = dtable.Rows.Count - 2 To 7 Step -8
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - 5, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i
For i = dtable.Rows.Count - 3 To 6 Step -8
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - 3, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Graham Mayor" wrote in message
...
Just as I began to work out the macro to adjust the data ......

Frankly I believe you are better off without the AddressLayout fields -
otherwise it seems to work and should be easy to adapt to this task.

I still rather like the idea of manipulating the data. It should be
possible to adapt this method to work with any double sided format, but
this is stretching my programming skills and could take some time


--

Graham Mayor - Word MVP

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


Peter Jamieson wrote:
What about
a. you start with a label type mail merge main document. Suppose it
is a four card layout.
b. you duplicate the page and the table in it. You may also need to
asdjust the position and layout of the table on page 2
c. you have { NEXT } fields in cells 2 3 and 4 on page 1 but none on
page 2 d. suppose you want fields A and B on the front and fields B
and C on the back

In cell one on page one you have

{ SET B1 { MERGEFIELD B
}{ SET C1 { MERGEFIELD C
}{ MERGEFIELD A }
{ MERGEFIELD B }

in cell two you have

{ NEXT }{ SET B2 { MERGEFIELD B
}{ SET C2 { MERGEFIELD C
}{ MERGEFIELD A }
{ MERGEFIELD B }

and so on for cells 3 and 4.

On page two in cell one, you have

{ REF B2 }
{ REF C2 }

in cell two , you have

{ REF B1 }
{ REF C1 }

and so on (which way round exactly depends on the way the duplexing
works).
A really simple example seems to work - you can merge to a new
document to see. But
a. am I missing something?
b. ISTR that you can't SET and REF stuff such as ADDRESSBLOCK fields.

Peter Jamieson
"Doug Robbins - Word MVP" wrote in message
...
This cannot be done with mailmerge alone. What you need to do is
execute two merges, one for the front side and one for the back,
each one to a new document, then use a macro to combine those
documents into a single document taking alternate pages for each and
then print that combined document to your duplex printer.

I have previously set this sort of thing up for a person who was
merging two postcards to a sheet for which the following macro was
used to combine the documents. It will probably need modification
for your four cards per sheet:

Sub CombineDocs()

Dim sourcea As Document, sourceb As Document, target As Document

Dim i As Long, j As Long

Dim arange As Range

Set target = Documents.Open(FileName:="c:\target.doc")

Set sourcea = Documents.Open(FileName:="c:\sourcea.doc")

Set sourceb = Documents.Open(FileName:="c:\sourceb.doc")

j = 2 * sourcea.Tables(1).Rows.Count - 1

For i = 1 To j

target.Tables(1).Rows.Add

Next i

With sourcea.Tables(1)

For i = 1 To .Rows.Count

Set arange = .Rows(i).Cells(1).Range

arange.End = arange.End - 1

If i Mod 2 = 1 Then

j = 1

Else

j = 2

End If

target.Tables(1).Cell(2 * i - j, 1).Range.FormattedText =
arange

Next i

End With

With sourceb.Tables(1)

For i = 1 To .Rows.Count

Set arange = .Rows(i).Cells(1).Range

arange.End = arange.End - 1

If i Mod 2 = 1 Then

j = 1

Else

j = 0

End If

target.Tables(1).Cell(2 * i + j, 1).Range.FormattedText =
arange

Next i

End With

sourcea.Close wdDoNotSaveChanges

sourceb.Close wdDoNotSaveChanges

End Sub



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"taxmom" wrote in message
...
I need to print a postcards using 4 cards per 8 1/2 x 11 paper. I
want to put merge specific data on the front of the card and the
clients name and mailing address on the back of the card. Can
anyone walk me through the steps to do this. I am not having any
problems with the mail merge function,
I just can't figure out how to do the double sided merge. I do have
duplex
printing capabilities