R
Rob
I want to use a VB program to add different odd and even headers with
different text and right aligned pagenumber for odd and left alignment for
even. My code inserts the different text for odd/even but the alignment
changes to the last executed alignment. ie- left.
Imports MSW = Microsoft.Office.Interop.Word
Imports WHF = Microsoft.Office.Interop.Word.WdHeaderFooterIndex
With ActiveDocument.Sections(Sct)
.Headers(WHF.wdHeaderFooterPrimary).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterEvenPages).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterFirstPage).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterPrimary).Range.Font.Size = 10
.Headers(WHF.wdHeaderFooterPrimary).Range.Text = "CHAPTER " & Ch
.Headers(WHF.wdHeaderFooterPrimary).Range.Paragraphs.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
..Headers(WHF.wdHeaderFooterPrimary).PageNumbers.Add(MSW.WdPageNumberAlignment.wdAlignPageNumberRight, True)
.Headers(WHF.wdHeaderFooterPrimary).PageNumbers.NumberStyle =
Microsoft.Office.Interop.Word.WdPageNumberStyle.wdPageNumberStyleArabic
.Headers(WHF.wdHeaderFooterEvenPages).Range.Font.Size = 10
.Headers(WHF.wdHeaderFooterEvenPages).Range.Text = "ACTS OF THE
GENERAL ASSEMBLY"
.Headers(WHF.wdHeaderFooterEvenPages).Range.Paragraphs.Alignment
= Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
..Headers(WHF.wdHeaderFooterEvenPages).PageNumbers.Add(MSW.WdPageNumberAlignment.wdAlignPageNumberLeft, True)
.Headers(WHF.wdHeaderFooterEvenPages).PageNumbers.NumberStyle =
Microsoft.Office.Interop.Word.WdPageNumberStyle.wdPageNumberStyleArabic
End With
Is this a bug or am I doing something wrong. I have tried many different
ways of doing this.
different text and right aligned pagenumber for odd and left alignment for
even. My code inserts the different text for odd/even but the alignment
changes to the last executed alignment. ie- left.
Imports MSW = Microsoft.Office.Interop.Word
Imports WHF = Microsoft.Office.Interop.Word.WdHeaderFooterIndex
With ActiveDocument.Sections(Sct)
.Headers(WHF.wdHeaderFooterPrimary).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterEvenPages).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterFirstPage).LinkToPrevious = False
.Headers(WHF.wdHeaderFooterPrimary).Range.Font.Size = 10
.Headers(WHF.wdHeaderFooterPrimary).Range.Text = "CHAPTER " & Ch
.Headers(WHF.wdHeaderFooterPrimary).Range.Paragraphs.Alignment =
Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
..Headers(WHF.wdHeaderFooterPrimary).PageNumbers.Add(MSW.WdPageNumberAlignment.wdAlignPageNumberRight, True)
.Headers(WHF.wdHeaderFooterPrimary).PageNumbers.NumberStyle =
Microsoft.Office.Interop.Word.WdPageNumberStyle.wdPageNumberStyleArabic
.Headers(WHF.wdHeaderFooterEvenPages).Range.Font.Size = 10
.Headers(WHF.wdHeaderFooterEvenPages).Range.Text = "ACTS OF THE
GENERAL ASSEMBLY"
.Headers(WHF.wdHeaderFooterEvenPages).Range.Paragraphs.Alignment
= Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
..Headers(WHF.wdHeaderFooterEvenPages).PageNumbers.Add(MSW.WdPageNumberAlignment.wdAlignPageNumberLeft, True)
.Headers(WHF.wdHeaderFooterEvenPages).PageNumbers.NumberStyle =
Microsoft.Office.Interop.Word.WdPageNumberStyle.wdPageNumberStyleArabic
End With
Is this a bug or am I doing something wrong. I have tried many different
ways of doing this.