Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Conditional dsplay of header and footer text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Doe - 09 Dec 2004 16:14 GMT
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
Jonathan West - 09 Dec 2004 16:28 GMT
> Hi,
>
[quoted text clipped - 7 lines]
>
> 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

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

fumei - 23 Dec 2004 19:25 GMT
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.
Charles Kenyon - 09 Dec 2004 16:29 GMT
Take a look at http://www.mvps.org/word/FAQs/Numbering/PageNumbering.htm.

Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Hi,
>
[quoted text clipped - 7 lines]
>
> Penn
John Doe - 09 Dec 2004 17:45 GMT
Excellent!  Thank you both very much.

Penn
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.