M
Mark Lincoln
I'm adding VBA code (Word 2003) in a UserForm to add a confidentiality
notice in a footer on a fax cover sheet template, at the discretion of
the user. The code below adds the footer text (nearly six full lines
of legalese), justifies it, and adds a border above the text:
If AddConfNotice Then
Dim CN As String
CN = "(A bunch of long-winded legal mumbo-jumbo.)"
With
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
.Text = CN
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Borders(wdBorderTop).Visible = True
End With
End If
This code is part of a Sub that inserts the sender's phone and fax
numbers as well as the recipient's name, fax number, etc.
The code works fine except that once it finishes there is a line at
the top of the page that appears to be a border at the bottom of the
header area and that I have not inserted. If I print the doc as is or
edit its text, the line is printed. However, if I open Print Preview
the line disappears, is no longer visible on the doc when exiting the
Print Preview window, and does not print. The line also immediately
disappears if I go to View|Header and Footer.
I've moved the code to various places, including a UserForm called
afterward to get the number of pages being faxed, but the line still
appears. It also appears if I comment out the line that adds the
footer border.
I originally had the notice as part of the template and deleted it
when necessary, with the same problem.
To make matters worse, I cannot duplicate this behavior in a new
template; the code works perfectly.
The problem template was originally created in 2001 using Word 97. I
may have to try recreating it, either before or after beating my head
against the wall. Before I do that, though (my head already hurts), I
wonder if there might be something I can look for that could be
causing this to happen and that I can eliminate with relative ease.
Many thanks to anyone who can come up with an answer!
Mark Lincoln
notice in a footer on a fax cover sheet template, at the discretion of
the user. The code below adds the footer text (nearly six full lines
of legalese), justifies it, and adds a border above the text:
If AddConfNotice Then
Dim CN As String
CN = "(A bunch of long-winded legal mumbo-jumbo.)"
With
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
.Text = CN
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Borders(wdBorderTop).Visible = True
End With
End If
This code is part of a Sub that inserts the sender's phone and fax
numbers as well as the recipient's name, fax number, etc.
The code works fine except that once it finishes there is a line at
the top of the page that appears to be a border at the bottom of the
header area and that I have not inserted. If I print the doc as is or
edit its text, the line is printed. However, if I open Print Preview
the line disappears, is no longer visible on the doc when exiting the
Print Preview window, and does not print. The line also immediately
disappears if I go to View|Header and Footer.
I've moved the code to various places, including a UserForm called
afterward to get the number of pages being faxed, but the line still
appears. It also appears if I comment out the line that adds the
footer border.
I originally had the notice as part of the template and deleted it
when necessary, with the same problem.
To make matters worse, I cannot duplicate this behavior in a new
template; the code works perfectly.
The problem template was originally created in 2001 using Word 97. I
may have to try recreating it, either before or after beating my head
against the wall. Before I do that, though (my head already hurts), I
wonder if there might be something I can look for that could be
causing this to happen and that I can eliminate with relative ease.
Many thanks to anyone who can come up with an answer!
Mark Lincoln