Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Phantom Border

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Lincoln - 06 Nov 2007 18:06 GMT
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
kiremark@gmail.com - 06 Nov 2007 19:26 GMT
> 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
[quoted text clipped - 44 lines]
>
> Mark Lincoln

Did you try:

.Borders(wdBorderTop).Visible = False
Mark Lincoln - 06 Nov 2007 20:15 GMT
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

On Nov 6, 2:26 pm, "kirem...@gmail.com" <kirem...@gmail.com> wrote:

> > 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
[quoted text clipped - 50 lines]
>
> - Show quoted text -
Mark Lincoln - 07 Nov 2007 22:48 GMT
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

> Yes, I tried that when deleting an existing footer and still got the
> line at the top.
[quoted text clipped - 67 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.