variable contents of headers or footers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I wonder if someone else has tried to do this. I'm writing a book and
what I have is a database of quotes that I want printed, one at the top of
each page. In other words, it will print as many quotes as there are pages.

I tried to achieve this with mailmerge by using the merge fields in the
header, followed by 'next' to force it to go on to the next record, so that
each time the header was printed it would pick the next quote in the list.
Thus, I'd ultimately only get one copy of the book in the resulting merged
document, but that one copy would have used up most of the quotes in the data
source file by printing one in each page. However, Word 2000 said it wouldn't
let me insert the 'next' field into headers or footers. Any alternative
solutions, or do later versions of word allow something like that?

Thanks,

Mike Hersee
 
Hi =?Utf-8?B?TWlrZUhlcnNlZQ==?=,

The problem with using the header/footer for this is that these are specifically
designed to *duplicate* information across all pages (in the same section).

If mail merge would work for you, generally, then position a FRAME (inserted
from the Forms toolbar) in the header area and insert the merge field into it.
Execute the merge, and you should get different content on each page.

Note: use a Catalog (directory) type of mail merge in order to avoid section
breaks between the pages. Put a manual page break into the document, instead. You
can later delete these very quickly using Edit/Replace. Click the "More" button
and then "Special" in order to search for "Manual Page Break". Replace it with
nothing (empty box).
I'm writing a book and
what I have is a database of quotes that I want printed, one at the top of
each page. In other words, it will print as many quotes as there are pages.

I tried to achieve this with mailmerge by using the merge fields in the
header, followed by 'next' to force it to go on to the next record, so that
each time the header was printed it would pick the next quote in the list.
Thus, I'd ultimately only get one copy of the book in the resulting merged
document, but that one copy would have used up most of the quotes in the data
source file by printing one in each page. However, Word 2000 said it wouldn't
let me insert the 'next' field into headers or footers. Any alternative
solutions, or do later versions of word allow something like that?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)
 
Hi Cindy, thanks for that advice. However, I still couldn't get the contents
of the headers to change. I didn't want to put hard coded page breaks in
because that would defeat to a large extent the whole purpose of doing it
automatically, so it automatically adjusts to the actual final number of
pages, and doesn't need to be redone manually when editing occurs. It
wouldn't be so bad if it was a short book, but it's 200 pages at present and
is likely to climb to about 350! Looks like I might need to try macros or
something.
 
Hi =?Utf-8?B?TWlrZSBIZXJzZWU=?=,
However, I still couldn't get the contents
of the headers to change.
I think there may be a misunderstanding, here: I meant to position the
frames physically in the space occupied by the headers. But I did NOT mean
to be in the header/footer view. Just in the document view.
I didn't want to put hard coded page breaks in
because that would defeat to a large extent the whole purpose of doing it
automatically
I did mention that, after the merge, you should use find/replace to remove
them... However, given the additional information you write in this message,
mail merge would not be an option.
Looks like I might need to try macros or
something.
Yes, I'd look at making a macro that moves to each page in succession, makes
sure it's in the first paragraph on that page (for the purposes of anchoring
the Frame), insert the frame, then its text, position and format.

For the last part, I suggest creating a STYLE that takes care of the
positioning and formatting. Then, all the macro will need to do is insert an
empty paragraph and apply the style to it. Enter the text, and continue on.

Here's a bit of macro code to get you started. Just make sure there are at
least two paragraphs on every page...

Sub InsertQuoteFrameOnEveryPage()
Dim rng As Word.Range
Dim i As Long

Selection.HomeKey wdStory
For i = 1 To _
ActiveDocument.Range.Information( _
wdNumberOfPagesInDocument)
Selection.GoTo _
What:=wdGoToPage, _
Which:=wdGoToAbsolute, _
Count:=i
Set rng = ActiveDocument.Bookmarks( _
"\Page").Range
Set rng = rng.Paragraphs(1).Range
rng.Collapse wdCollapseEnd
rng.Text = vbCr
rng.Style = "QuoteFrame"
rng.Text = "here's quote " & i
Next
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
Goodness Me! Thank you for very much that detail, I really appreciate it.
I'll set to.

Mike
 
Back
Top