First page headers/footers

D

Dave Stone

I guess there must be a magic formula for persuading Word
to put different headers/footers on the first page of a
document from all the rest, but I can't figure it out.
What I have in effect is:

ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter =
True
With ActiveDocument.Sections(1).Header _
(wdHeaderFooterPrimary)
SubjCateg = "CLASSICS"
.Range.InsertAfter (SubjCateg & vbCrLf)
End With
With ActiveDocument.Sections(1).Headers _
(wdHeaderFooterFirstPage)
SubjCateg = "DIFFERENT"
.Range.InsertAfter (SubjCateg & vbCrLf)
End With

But all the headers come out as "CLASSICS"! Don't seem
logical to me....

Dave
 
M

Mark Tangard

Dave,

It works when I try it (after fixing the typo in line 2
(Header-> Header*s*). What happens if you add the
Section property to the first line:

ActiveDocument.Sections(1).PageSetup ....

so that the section is specified explicitly, like it is
in the other statements?
 
M

Mark Tangard

Dave,

Just tried it on my home machine (same Word vesrion, different
operating system) and it still works. Could your installation
be somehow spooked, say by an accumulation of temp files?

I can't imagine changing the starting page number would affect
this. But by super-odd coincidence, today at work I banged out
a little macro to do exactly that. Can't say this might help,
but maybe a clue will surface when I show you what I wrote:

Dim n As Long
n = InputBox("New starting page number." & vbCr & _
"Current = " & Selection.Sections(1).Headers(1). _
PageNumbers.StartingNumber)
With Selection.Sections(1).Headers(1).PageNumbers
.RestartNumberingAtSection = True
.StartingNumber = n
End With

One odd thing I found was that even though my page numbers
are in the footer, I had to use 'Headers(1)' as shown in
order for the macro to work.

One other very long shot: Are your page numbers in the body
of the header/footer, or are they in a frame. (The latter,
produced by the tainted 'Insert Page Numbers' command, is
known to cause problems -- what sort, I can't recall just
now.)

Beyond this I'm stumped. Sorry.
 

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