Option Explicit
Dim i As Long
Dim j As Long
Dim oDoc As Word.Document
Sub AddSectionAndKillLinkToPrevious()
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 all three header\footer types.
lbl_Exit:
Exit Sub
End Sub
Dim i As Long
Dim j As Long
Dim oDoc As Word.Document
Sub AddSectionAndKillLinkToPrevious()
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 all three header\footer types.
lbl_Exit:
Exit Sub
End Sub
No comments:
Post a Comment