S
Stephen English
Hi
I was hoping that the last line of code below would allow me to insert a
different header for each section like you can do manually. But each time I
chage it, it changes the headers on every page in the document to be the new
one!
Any ideas please?
Stephen
Dim rTmp1 As Word.Range
Dim rtmp2 As Word.Range
Dim sTmp As String
Dim lTmp As Long
Dim lTmpr As Long
sTmp = "YEAR " & rsYears!Year & vbCrLf
With docMaster.Bookmarks("Start")
lTmpr = Len(.Range)
Set rTmp1 = .Range
.Delete
End With
With rTmp1
.InsertBreak Type:=wdSectionBreakNextPage
intSection = intSection + 1
.InsertBefore sTmp
.Start = .Start + Len(sTmp)
.Bookmarks.Add "Start"
End With
docMaster.Sections(intSection).Headers(wdHeaderFooterPrimary).Range.Text =
"YEAR " & rsYears!Year
I was hoping that the last line of code below would allow me to insert a
different header for each section like you can do manually. But each time I
chage it, it changes the headers on every page in the document to be the new
one!
Any ideas please?
Stephen
Dim rTmp1 As Word.Range
Dim rtmp2 As Word.Range
Dim sTmp As String
Dim lTmp As Long
Dim lTmpr As Long
sTmp = "YEAR " & rsYears!Year & vbCrLf
With docMaster.Bookmarks("Start")
lTmpr = Len(.Range)
Set rTmp1 = .Range
.Delete
End With
With rTmp1
.InsertBreak Type:=wdSectionBreakNextPage
intSection = intSection + 1
.InsertBefore sTmp
.Start = .Start + Len(sTmp)
.Bookmarks.Add "Start"
End With
docMaster.Sections(intSection).Headers(wdHeaderFooterPrimary).Range.Text =
"YEAR " & rsYears!Year