smccaffr39
04-23-2016, 04:46 AM
hello all. i have this code that i have an issue with:
Private Sub AddLines()
With ActiveDocument
With .PageSetup
.TopMargin = InchesToPoints(1)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(0.75)
.RightMargin = InchesToPoints(0.75)
.DifferentFirstPageHeaderFooter = True
.OddAndEvenPagesHeaderFooter = True
End With
With .Sections(1)
.Headers(wdHeaderFooterFirstPage).Shapes.AddLine BeginX:=InchesToPoints(0.75 - 0.08), _
BeginY:=InchesToPoints(1), EndX:=InchesToPoints(0.75 + 7 + 0.08), EndY:=InchesToPoints(1)
.Headers(wdHeaderFooterPrimary).Shapes.AddLine BeginX:=InchesToPoints(0.75 - 0.08), _
BeginY:=InchesToPoints(1), EndX:=InchesToPoints(0.75 + 7 + 0.08), EndY:=InchesToPoints(1)
End With
End With
End Sub
i've included the addition to aid in the interpretation. ideally, it should a line that starts .08" to the left of the text margin and is 7.16" long to both the first page and primary/3rd page.
the problem is that in Word 2010, it adds the line to the primary page header twice. no idea why. i've tried it on 2 different computers, though, they are using the same normal.dotm. in 2013, this code adds the line to each the first page and primary (3rd) page. any help with would be much appreciated!
Private Sub AddLines()
With ActiveDocument
With .PageSetup
.TopMargin = InchesToPoints(1)
.BottomMargin = InchesToPoints(0.5)
.LeftMargin = InchesToPoints(0.75)
.RightMargin = InchesToPoints(0.75)
.DifferentFirstPageHeaderFooter = True
.OddAndEvenPagesHeaderFooter = True
End With
With .Sections(1)
.Headers(wdHeaderFooterFirstPage).Shapes.AddLine BeginX:=InchesToPoints(0.75 - 0.08), _
BeginY:=InchesToPoints(1), EndX:=InchesToPoints(0.75 + 7 + 0.08), EndY:=InchesToPoints(1)
.Headers(wdHeaderFooterPrimary).Shapes.AddLine BeginX:=InchesToPoints(0.75 - 0.08), _
BeginY:=InchesToPoints(1), EndX:=InchesToPoints(0.75 + 7 + 0.08), EndY:=InchesToPoints(1)
End With
End With
End Sub
i've included the addition to aid in the interpretation. ideally, it should a line that starts .08" to the left of the text margin and is 7.16" long to both the first page and primary/3rd page.
the problem is that in Word 2010, it adds the line to the primary page header twice. no idea why. i've tried it on 2 different computers, though, they are using the same normal.dotm. in 2013, this code adds the line to each the first page and primary (3rd) page. any help with would be much appreciated!