|

|
|

|
|
Say I want to change the section two header text to: |
|

|
| Seems easy enough, but to my chagrin and the chagrin of
countless other Word users, the overall effects can seem disastrous.
My point is illustrated if you go back and see the effect that the change in
sections two's header had on section one's header |
|

|
|
The cause of this is folly is that headers and footers are
linked to the previous header and footer when a new section is added with
the user interface (Insert>Break). |
|

|
|
And to complicate matters further, a Word document with sections is sort of
like an old fashioned player piano sheet. While the section one header
does not display "Same as Previous," the last section of a document (in our
case section two) functions in effect as the previous section to section
one. That is why when sections are linked, changes in subsequent
sections can roll through a document changing other section's header and
footer text in a seemingly mutant manner ;-) |
|
Here is a macro that you can use to insert a new section. The content
of the header and footer of the previous section is carried into the new
section's header and footer when it is created and then the link is broken.
This allows you to make changes in the new header or footer that won't
affect the header and footer of the previous section. |
Sub AddSectionAndKillLinkToPrevious()
Dim i As Long
Dim j As Long
Dim oDoc As Word.Document
Dim myRng As Word.Range
Set oDoc = ActiveDocument
Selection.InsertBreak Type:=wdSectionBreakNextPage
'Get the index number of the added section
i = oDoc.Range(0, Selection.Sections(1).Range.End).Sections.Count
With oDoc.Sections(i)
For j = 1 To 3
.Headers(j).LinkToPrevious = False
.Footers(j).LinkToPrevious = False
Next j
End With
'Note: j provides the constant value to unlink
the primary page
'(and the first/even page [if exists]) header/footer in the new section
End Sub |
| Should you have a need to reestablish the link between
headers and footers, you can use: |
Sub RelinkSections()
Dim i As Long
Dim j As Long
Dim oDoc As Word.Document
Dim myRng As Word.Range
Set oDoc = ActiveDocument
For i = 1 To oDoc.Sections.Count
With oDoc.Sections(i)
For j = 1 To 3
.Headers(j).LinkToPrevious
= True
.Footers(j).LinkToPrevious
= True
Next j
End With
Next i
End Sub |
|
See:
Installing Macros for instructions on how to set up and use the macros
listed above.
See:
Setup Menu/Toolbar for instructions on how to run a macro from a menu or
toolbar icon.
See:
Keyboard Shortcut for instructions on how to assign a macro to a
keyboard shortcut. |
|
|
Looking for something else? |
|
|
|
|
|
|