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 / March 2005

Tip: Looking for answers? Try searching our database.

2-page letter repeats 1st page in 2nd page header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
R. Choate - 16 Mar 2005 23:39 GMT
I have a large app in Word that calls a letterhead template file to apply letterhead on the 1st page. Once I finally got that
working, a new problem cropped up. When the letter is longer than one page, I have some code (shown below) for applying certain
information in the header on the 2nd page. Now, instead of getting that, I'm getting the entire first page of the letter repeated in
the 2nd page header. None of the stuff I want in the 2nd page header shows up. Here is my code for the 2nd page header. It is in a
sub by itself:

MyDate = DateSerial(Year(Date), Month(Date), Day(Date))
Application.ScreenUpdating = False
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)

   .Range.Fields.Add Range:=ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range, _
           Type:=wdFieldEmpty, Text:="REF clientname", PreserveFormatting:=False
   .Range.InsertAfter vbCr
   .Range.InsertAfter Format(MyDate, "mmmm d, yyyy")
   .Range.InsertAfter vbCr
   .Range.InsertAfter "Page " & _
           ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
   .Range.Font.Size = 10
   .Range.ParagraphFormat.Alignment = wdAlignParagraphLeft

End With

End Sub

Please help. I finally got the letterhead working but I can't have this new problem ruin everything. Here is the code which calls
the letterhead template:

'starts new document
   strPath = "C:\Documents and Settings\Administrator\Desktop\"
   strName = "Letterhead template.dot"
   Documents.Add Template:=strPath & strName, _
   NewTemplate:=False, _
   DocumentType:=wdNewBlankDocument, _
   Visible:=True

Signature

RMC,CPA

Cindy M  -WordMVP- - 28 Mar 2005 16:45 GMT
Hi R.,

> .Range.Fields.Add Range:=ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range, _
>             Type:=wdFieldEmpty, Text:="REF clientname", PreserveFormatting:=False

Have you checked where the bookmark clientname is actually located, and what it contains? My
thought would be that it's holding the text of the document...

Also, just to check, you do have "Different First Page" activated in File/Page Setup/Layout?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :-)
R. Choate - 29 Mar 2005 19:24 GMT
Hi Cindy,

It is interesting how far away the people are who I get help from (or sometimes give help to in Excel and Access). I believe your
question is at the heart of the problem and I'll be looking into that in just a few minutes. I'm counting on that being the answer.
If not, I'll be back. As to your 2nd question, I do have "Different First Page" selected and that part seems to be doing OK. The
letterhead does not show up on the subsequent pages.

Thanks Cindy,
Signature

RMC,CPA

"Cindy M -WordMVP-" <C.Meister-C@hispeed.ch> wrote in message news:VA.0000aa64.0081b274@speedy...
Hi R.,

> .Range.Fields.Add Range:=ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range, _
>             Type:=wdFieldEmpty, Text:="REF clientname", PreserveFormatting:=False

Have you checked where the bookmark clientname is actually located, and what it contains? My
thought would be that it's holding the text of the document...

Also, just to check, you do have "Different First Page" activated in File/Page Setup/Layout?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :-)
 
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.