Display header for section 3 only

A

Alex St-Pierre

Hi !
I'm using this command to put page number starting at page 3 and more. There
are wdSectionBreakNextPageSet after page 1 and page 2. Does anyone know why
the page number start at page 1 (section 1)?
Set oRange = docWord.Sections(3).Headers(1).Range
oRange.InsertAfter "Page "
oRange.Collapse wdCollapseEnd
oRange.Fields.Add Range:=oRange, Type:=wdFieldPage
Thanks!!
Alex
 
S

Stefan Blom

The starting page number must be specified on a section basis. For
example:

With ActiveDocument.Sections(3).Headers(1).PageNumbers
.RestartNumberingAtSection = True
.StartingNumber = 3 'specify the number you want!
End With

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
S

Stefan Blom

Hmm, I just realized that I may have misunderstood your first
question. If the problem is that you want to keep the headers of the
first two sections blank, so that they do not reflect any insertions
made in section 3, you should use this code to unlink them:

docWord.Sections(1).Headers(1).LinkToPrevious = False
docWord.Sections(2).Headers(1).LinkToPrevious = False
docWord.Sections(3).Headers(1).LinkToPrevious = False

Then try to insert page numbers with your original code.

Note that each section actually has three different headers (and
footers); you may want to unlink those too, using Headers(2),
Headers(3) (and similarly for the footers). They won't display,
however, unless you enable the DifferentFirstPageHeaderFooter and
OddAndEvenPagesHeaderFooter properties.

--
Stefan Blom
Microsoft Word MVP


in message
 

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