B
Bert
I'm using VBA to alter chapter headers (one primary header, one even page
header) for each section (chapter) of a document.
(I know I could use Word's cross references and header styles to deal with
chapters,
but I'd prefer to do it this way.) I start with the insertion point in
the current section. When the macro runs, it:
1. finds the chapter number of the current section
2. adds a new section at the selection point (at the end of the currently
"active" chapter)
3. inserts the chapter number and chapter title in the body of the new
section
(thus moving the selection point to the new section),
4. and then adds a new chapter number at the appropriate point in the
headers.
The problem I'm having is that the macro doesn't seem to recognize there is
a new header in a new section.
It does not change the header in the new section, but rather changes the
header in the now-previous section.
It's almost as if it still thinks that previous section still is the
location of the selection point.
I'm using the following code to make the change in the header.
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.InsertAfter
NxtChp
Any suggestions as to how to fix this?
Thanks.
Bert
header) for each section (chapter) of a document.
(I know I could use Word's cross references and header styles to deal with
chapters,
but I'd prefer to do it this way.) I start with the insertion point in
the current section. When the macro runs, it:
1. finds the chapter number of the current section
2. adds a new section at the selection point (at the end of the currently
"active" chapter)
3. inserts the chapter number and chapter title in the body of the new
section
(thus moving the selection point to the new section),
4. and then adds a new chapter number at the appropriate point in the
headers.
The problem I'm having is that the macro doesn't seem to recognize there is
a new header in a new section.
It does not change the header in the new section, but rather changes the
header in the now-previous section.
It's almost as if it still thinks that previous section still is the
location of the selection point.
I'm using the following code to make the change in the header.
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.InsertAfter
NxtChp
Any suggestions as to how to fix this?
Thanks.
Bert