D
Dale Fye
Thanks to those of you that have already contributed to this project.
After generating numerous versions Word documents based on data in an Access
database, my client has decided to make a minor change to the Word document.
They would like to see a header on each page that provides a quick reference
to the section of the document we are in. Right now, I am just inserting
this as a line of text at the top of the page at the beginning of a loop
through my recordset.
Now, instead of just starting a new page for each of these records, I think
I need to insert a new section break with page break(except for the first
record), and then create a header for the section. The code currently looks
something like:
set rs = Currentdb.Openrecordset(strSQL, , dbfailonerror)
While not rs.eof
DoEvents
With wdDoc.Application.Selection
.TypeText Text:= "Section label: " & rs("SomeField")
.TypeParagraph
'some other stuff here
rs.MoveNext
If rs.EOF Then
'dont add any more pagebreaks
ElseIf (bDuplex = True) _
And (.Information(wdActiveEndPageNumber) Mod 2 = 1) Then
.InsertBreak Type:=wdPageBreak
.InsertBreak Type:=wdPageBreak
Else
.InsertBreak Type:=wdPageBreak
End If
End With
Wend
Any guidance would be greatly appreciated.
After generating numerous versions Word documents based on data in an Access
database, my client has decided to make a minor change to the Word document.
They would like to see a header on each page that provides a quick reference
to the section of the document we are in. Right now, I am just inserting
this as a line of text at the top of the page at the beginning of a loop
through my recordset.
Now, instead of just starting a new page for each of these records, I think
I need to insert a new section break with page break(except for the first
record), and then create a header for the section. The code currently looks
something like:
set rs = Currentdb.Openrecordset(strSQL, , dbfailonerror)
While not rs.eof
DoEvents
With wdDoc.Application.Selection
.TypeText Text:= "Section label: " & rs("SomeField")
.TypeParagraph
'some other stuff here
rs.MoveNext
If rs.EOF Then
'dont add any more pagebreaks
ElseIf (bDuplex = True) _
And (.Information(wdActiveEndPageNumber) Mod 2 = 1) Then
.InsertBreak Type:=wdPageBreak
.InsertBreak Type:=wdPageBreak
Else
.InsertBreak Type:=wdPageBreak
End If
End With
Wend
Any guidance would be greatly appreciated.