Conditional dsplay of header and footer text

J

John Doe

Hi,

I would like to display different first page footer text (Word 2003)
depending upon whether or not there is a second (or subsequent) page(s).

Does anyone know how this could be done? I've tried internet searching and
in-program searching with no luck.

Thank you very much,

Penn
 
J

Jonathan West

John Doe said:
Hi,

I would like to display different first page footer text (Word 2003)
depending upon whether or not there is a second (or subsequent) page(s).

Does anyone know how this could be done? I've tried internet searching
and in-program searching with no luck.

Thank you very much,

Penn

Hi Penn,

You need to use an IF field. In the first page header, include a field like
this

{ IF { NUMPAGES } = 1 "only one page" "extra pages" }

where the { } characters are field braces inserted using Ctrl-F9
 
F

fumei

A alternative:

Selection.HomeKey unit:=wdStory
If Selection.Sections(1).Range.ComputeStatistics(wdStatisticPages) > 1
Then
With Selection.PageSetup
.DifferentFirstPageHeaderFooter = True
End With
End If

This test to see if the first Section has more than 1 page; if it does, it
sets Section PageSetup Different First page = True.

You could also further explicitly make the header different text. it is
important to note that Sections in Words ALWAYS have three headers -
regardless of whether there are Different first page, or Different Odd/Even.
There is NO header for odd pages. There are:

wdHeaderFooterPrimary (index = 1)
wdHeaderFooterFirstPage (index = 2)
wdHeaderFooterEvenPage (index = 3)

So you could do:

Selection.HomeKey unit:=wdStory
If Selection.Sections(1).Range.ComputeStatistics(wdStatisticPages) > 1
Then
With Selection.PageSetup
.DifferentFirstPageHeaderFooter = True
End With
Selection.Sections(1).Headers(1).Range.Text = "all other headersr"
Selection.Sections(1).Headers(2).Range.Text = "firstpage"
End If

This would explicitly insert text into the proper header.
 

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