Phantom Border

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
 
K

kiremark

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


Did you try:

..Borders(wdBorderTop).Visible = False
 
M

Mark Lincoln

Yes, I tried that when deleting an existing footer and still got the
line at the top.

There seems to be a problem with the addition or deletion of the
footer text. Doing either produces the phantom border.

I'm beginning to suspect slight corruption in the document portion of
the template. I may well have to resort to reproducing the whole
template from scratch. (I sure hope the problem isn't in the user
forms or modules, as I'd like to import them.)

Mark Lincoln
 
M

Mark Lincoln

I've solved the problem by recreating the page from scratch and
importing my AutoNew module and user forms into the new template.
There must have been some problem introduced by saving the original
Word 97 file in Word 2003.

Mark Lincoln
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top