Print Section Number on page

J

Jojo

I have a mail merge document to print postcards with duplex.
This means 2 pages per section and 4 records per section.

I want to print the section number but am having trouble.
I tried Insert > Field... {Section} and {SectionPages} but
neither one worked.

Anybody have an idea?
 
D

Doug Robbins - Word MVP

There are a number of fields that will not survive the execution of a mail
merge and the Section and SectionPages fields are two of them.

It might be best to put the numbers that you want in a field in the data
source.

You may be interested in the following method of creating post cards with
data printed on both sides.

To do this, you would use a two page form letter type mail merge main
document with the text and merge fields set up for each side of the card in
that document.

Then, with your data source which must be in the form of a table in a Word
document open as the active document, you would run the following macro.
This will ask you how many cards there are across and how many down, and
then it will create a new data source with the records duplicated in the
correct order so that when you attach this new data source to the form
letter type mail merge main document, and execute the merge, the required
information will appear on each side of the card.


Dim i As Long, j As Long, k As Long, l As Long, n As Long, m As Long
Dim dtable As Table
Dim arec As Range
Dim dsource As String

dsource = ActiveDocument.FullName
Set dtable = ActiveDocument.Tables(1)

GoThere:
m = InputBox("Enter the number of cards across (1 or 2)", "Duplex Labels")
If Not IsNumeric(m) Then
GoTo GoThere
ElseIf m < 1 Or m > 2 Then
GoTo GoThere
End If

GoHere:
k = InputBox("Enter the number of rows of cards on the sheet.", "Duplex
Labels")
If Not IsNumeric(k) Then
GoTo GoHere
ElseIf m < 1 Then
GoTo GoHere
End If

dsource = Left(dsource, InStr(dsource, ".") - 1) & " - Duplex for " & m &
"x" & k & ".doc"
If m = 1 Then
i = (dtable.Rows.Count - 1) Mod k
If i > 0 Then
For j = 1 To k - i
dtable.Rows.Add
Next j
End If
For l = dtable.Rows.Count - (k - 1) To k + 1 Step -k
For j = 1 To k
dtable.Rows.Add (dtable.Rows(l))
Next j
Next l
For j = 1 To k
dtable.Rows.Add
Next j
For n = 1 To k
For i = dtable.Rows.Count + 1 - n To k + 2 - n Step -2 * k
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - k, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i
Next n
Else
k = 2 * k
i = (dtable.Rows.Count - 1) Mod k
If i > 0 Then
For j = 1 To k - i
dtable.Rows.Add
Next j
End If
For l = dtable.Rows.Count - (k - 1) To k + 1 Step -k
For j = 1 To k
dtable.Rows.Add (dtable.Rows(l))
Next j
Next l
For j = 1 To k
dtable.Rows.Add
Next j
For n = 1 To k
If n Mod 2 = 1 Then
l = -1
Else
l = 1
End If
For i = dtable.Rows.Count + 1 - n To (2 * k + 2 - n) Step -2 * k
For j = 1 To dtable.Columns.Count
Set arec = dtable.Cell(i - k + l, j).Range
arec.End = arec.End - 1
dtable.Cell(i, j).Range = arec
Next j
Next i
Next n
End If
ActiveDocument.SaveAs dsource


--
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
 
J

Jojo

Doug,

Thanks for the thorough reply. The explanation of those fields not
"surviving" a merge allowed me to focus on another direction. I'm
always looking for simple solutions so I wanted to stay away from VB.
Plus I thought I had come across another solution. So with my
refocus, I found "Formula" under Field Codes and came up with:
{ =int(({ MERGEREC }+4)/4) \# "0" }
The 4's are because I have 4 records per page.

Regards...
There are a number of fields that will not survive the execution of a mail
merge and the Section and SectionPages fields are two of them.

It might be best to put the numbers that you want in a field in the data
source.

You may be interested in the following method of creating post cards with
data printed on both sides.

To do this, you would use a two page form letter type mail merge main
document with the text and merge fields set up for each side of the card in
that document.

Then, with your data source which must be in the form of a table in a Word
document open as the active document, you would run the following macro.
This will ask you how many cards there are across and how many down, and
then it will create a new data source with the records duplicated in the
correct order so that when you attach this new data source to the form
letter type mail merge main document, and execute the merge, the required
information will appear on each side of the card.


Dim i As Long, j As Long, k As Long, l As Long, n As Long, m As Long
Dim dtable As Table
Dim arec As Range
Dim dsource As String
<snip>
 
J

Jojo

Graham,

It appears that that page only deals with formatting, which
I was able to figure out. In fact I had problems because
I needed to use Text Boxes and using standard Merge and Word
fields didn't work. I had to use Bookmarks. Anyway, I
found "Formula" under Field Codes and came up with:
{ =int(({ MERGEREC }+4)/4) \# "0" }
The 4's are because I have 4 records per page.

Regards...
 

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