different headers, footers between portrait and landscape?

J

James Merritt

I know it is possible to have different headers and footers for odd and even pages within a section. But is it possible to have different headers and footers for portrait vs. landscape pages that may be interspersed within a section? That is to say, for all portrait pages to have the same header and footer, and all landscape pages to have the same header and footer, which are different from those applied to the portrait pages

I am trying to avoid the situation of having to set up new sections AND new headers and footers every time I have to switch orientation between portrait and landscape in the doc. If a new landscape section would link to and follow the H/F from the last landscape section, and a new portrait section would link to and follow the H/F from the last portrait section, that would make me happy

This kind of thing is fairly easy (or at least straightforward) to do with FrameMaker, but my company wants everything done in Word (except for the occasional PDF for a client that demands it, and even that usually starts out as a word DOC). Have I missed anything that would help me get what I want from the header/footer/section mechanisms? Thanks in advance for any info or ideas.
 
S

Suzanne S. Barnhill

Have you considered AutoText fields?



James Merritt said:
I know it is possible to have different headers and footers for odd and
even pages within a section. But is it possible to have different headers
and footers for portrait vs. landscape pages that may be interspersed within
a section? That is to say, for all portrait pages to have the same header
and footer, and all landscape pages to have the same header and footer,
which are different from those applied to the portrait pages?
I am trying to avoid the situation of having to set up new sections AND
new headers and footers every time I have to switch orientation between
portrait and landscape in the doc. If a new landscape section would link to
and follow the H/F from the last landscape section, and a new portrait
section would link to and follow the H/F from the last portrait section,
that would make me happy.
This kind of thing is fairly easy (or at least straightforward) to do with
FrameMaker, but my company wants everything done in Word (except for the
occasional PDF for a client that demands it, and even that usually starts
out as a word DOC). Have I missed anything that would help me get what I
want from the header/footer/section mechanisms? Thanks in advance for any
info or ideas.
 
D

Doug Robbins - Word MVP

What you are after could be done with a macro that used
..PageSetup.Orientation to determine the orientation of each section and
applied the appropriate header/footers:

The following might be what you want:

Dim pflag As Boolean, lflag As Boolean, pfoot As Range, phead As Range,
lfoot As Range, lhead As Range
Dim i As Long
pflag = False
lflag = False
For i = 1 To ActiveDocument.Sections.Count
With ActiveDocument.Sections(i)
If .PageSetup.Orientation = wdOrientPortrait Then
If pflag = False Then
Set pfoot = .Footers(wdHeaderFooterPrimary).Range
Set phead = .Headers(wdHeaderFooterPrimary).Range
pflag = True
Else
.Footers(wdHeaderFooterPrimary).Range.FormattedText = pfoot
.Headers(wdHeaderFooterPrimary).Range.FormattedText = phead
End If
Else
If lflag = False Then
Set lfoot = .Footers(wdHeaderFooterPrimary).Range
Set lhead = .Headers(wdHeaderFooterPrimary).Range
lflag = True
Else
.Footers(wdHeaderFooterPrimary).Range.FormattedText = lfoot
.Headers(wdHeaderFooterPrimary).Range.FormattedText = lhead
End If
End If
End With
Next i


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
James Merritt said:
I know it is possible to have different headers and footers for odd and
even pages within a section. But is it possible to have different headers
and footers for portrait vs. landscape pages that may be interspersed within
a section? That is to say, for all portrait pages to have the same header
and footer, and all landscape pages to have the same header and footer,
which are different from those applied to the portrait pages?
I am trying to avoid the situation of having to set up new sections AND
new headers and footers every time I have to switch orientation between
portrait and landscape in the doc. If a new landscape section would link to
and follow the H/F from the last landscape section, and a new portrait
section would link to and follow the H/F from the last portrait section,
that would make me happy.
This kind of thing is fairly easy (or at least straightforward) to do with
FrameMaker, but my company wants everything done in Word (except for the
occasional PDF for a client that demands it, and even that usually starts
out as a word DOC). Have I missed anything that would help me get what I
want from the header/footer/section mechanisms? Thanks in advance for any
info or ideas.
 
J

James Merritt

Thanks, everyone, for tips and insights. Jay Freedman, yes, I realized my mis-statement concerning multiple page orientations within sections, when I re-read my posting after publishing it. Unfortunately, the truth of the matter actually makes my situation more intractable, as what I really would need, then, woubd be to be able to link back to the first previous similar section (similar in page orientation, at least). That would be a kludge feature, which I wouldn't reasonably expect Microsoft or anyone else to implement

The ideas involving autotext fields or macros are probably workable, but I'm really surprised that it seems as if a header or footer itself cannot be made into a "variable" or a "macro-like" object, which might be used anywhere a similar object is acceptable. What I need, at heart, is a way to say, a=odd portrait, b=odd landscape, c=even portrait, d=even landscape, e=page one, and so forth. Then, to be able to associate any particular header or footer to a-e, just as, for instance, I can associate a particular paragraph with a format from a pull-down menu. As often as problems like this would seem to have cropped up over the years, I wonder why it is still necessary to do tricky things or custom programming to get satisfaction with Word

Anyway, you folks have given me a lot to think about, and I will see what I can do. Thanks again.
 
S

Suzanne S. Barnhill

You could sort of get what you want if you saved each header as an AutoText
entry in Header style. They would then be available from the AutoText menu
on the Header and Footer toolbar. I thought of using an AutoTextList field
(see http://word.mvps.org/FAQs/TblsFldsFms/AutoTextList.htm) in the header,
but I think that would require that you create all the sections before
choosing an AutoText entry in any section.



James Merritt said:
Thanks, everyone, for tips and insights. Jay Freedman, yes, I realized my
mis-statement concerning multiple page orientations within sections, when I
re-read my posting after publishing it. Unfortunately, the truth of the
matter actually makes my situation more intractable, as what I really would
need, then, woubd be to be able to link back to the first previous similar
section (similar in page orientation, at least). That would be a kludge
feature, which I wouldn't reasonably expect Microsoft or anyone else to
implement.
The ideas involving autotext fields or macros are probably workable, but
I'm really surprised that it seems as if a header or footer itself cannot be
made into a "variable" or a "macro-like" object, which might be used
anywhere a similar object is acceptable. What I need, at heart, is a way to
say, a=odd portrait, b=odd landscape, c=even portrait, d=even landscape,
e=page one, and so forth. Then, to be able to associate any particular
header or footer to a-e, just as, for instance, I can associate a particular
paragraph with a format from a pull-down menu. As often as problems like
this would seem to have cropped up over the years, I wonder why it is still
necessary to do tricky things or custom programming to get satisfaction with
Word.
Anyway, you folks have given me a lot to think about, and I will see what
I can do. Thanks again.
 

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