Page numbering after TOC

R

Roger Knowles

Thanks Robert for previous assistance the Template I'm working on is nearing
completion....

Here's another problem if anyone can help....

I have a Macro that Inserts TOC.
A Page Break Before - This might become a new Page Section break
Then the TOC
Then a New Page Section Break.

In the Section following the TOC I want to alter the style for the Footer.

TOC has Docname CreateDate
Section following docName Page X of Y Create Date

I cannot seem to get the macro to navigate me to the section after I have
turned off Same as Previous, it jumps back to the TOC section and alters
that one. I thaught of using a Bookmark, and Goto, these are not being
picked up in the Head/Foot..

Any help/ideas as always appriciated.

Roger Knowles
MOS 97, 2000, 2002 Master
 
J

Jezebel

It's a little hard to advise since you haven't posted your code, but this
sort of macro problem usually arises if you try to 'navigate' in your macro
code using the selection object and the sort of navigation you do when
editing footers manually.

Assuming your document ends up with two sections, try something like

Dim pRange As Word.Range
With ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary)
.LinkToPrevious = False
.Range = ""
.Range.Fields.Add Range:=.Range, Type:=wdFieldFileName
.Range.InsertAfter vbTab & "Page "

Set pRange = .Range
pRange.Collapse Direction:=wdCollapseEnd
.Range.Fields.Add Range:=pRange, Type:=wdFieldPage

[.... etc .... ]
End With
 
R

Roger Knowles

Jezabel, Many thanks

Your code did the trick with one minor alteration. I added a variable to
check the section count and then in the Sections(2) I replaced with the
variable+1

you guys are great, thanks

As a trainer sometimes delegates are amazed by my knowledge of Apps...., I
am amazed by your knowledge......

Roger

Jezebel said:
It's a little hard to advise since you haven't posted your code, but this
sort of macro problem usually arises if you try to 'navigate' in your macro
code using the selection object and the sort of navigation you do when
editing footers manually.

Assuming your document ends up with two sections, try something like

Dim pRange As Word.Range
With ActiveDocument.Sections(2).Footers(wdHeaderFooterPrimary)
.LinkToPrevious = False
.Range = ""
.Range.Fields.Add Range:=.Range, Type:=wdFieldFileName
.Range.InsertAfter vbTab & "Page "

Set pRange = .Range
pRange.Collapse Direction:=wdCollapseEnd
.Range.Fields.Add Range:=pRange, Type:=wdFieldPage

[.... etc .... ]
End With



Roger Knowles said:
Thanks Robert for previous assistance the Template I'm working on is nearing
completion....

Here's another problem if anyone can help....

I have a Macro that Inserts TOC.
A Page Break Before - This might become a new Page Section break
Then the TOC
Then a New Page Section Break.

In the Section following the TOC I want to alter the style for the Footer.

TOC has Docname CreateDate
Section following docName Page X of Y Create Date

I cannot seem to get the macro to navigate me to the section after I have
turned off Same as Previous, it jumps back to the TOC section and alters
that one. I thaught of using a Bookmark, and Goto, these are not being
picked up in the Head/Foot..

Any help/ideas as always appriciated.

Roger Knowles
MOS 97, 2000, 2002 Master
 

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