View Single Post
  #17   Report Post  
Posted to microsoft.public.word.docmanagement
gil gil is offline
external usenet poster
 
Posts: 18
Default 10 most common problems for successful headers-footers?

Hi All,

I think I've found a work around for initiating new Header/Footers in an
existing document. A code sample is shown below.



The following code placed at the end or your multipage letter enters an
autotext called "sectHF5" which is comprised of an "empty" two lines of
non-first page header and a non-first page footer with centered page number.
It then substitues some variables ("ptNamx" and "ptDob") and an autotext
"myName" from normal.dot. The variables and autotext replace invisible
white colored text ("z.") in each of two lines of header and then converts
them to black.



The user has to be aware not to remove the section break at the bottom of
the file.



One has to make an initial autotext entry for the "blank header" and and
save it as "sectHF5" to normal.dot.



Making a "blank header section break" can be tricky. When making it, you
might need to have a hard page break above the section break in order to
reach "different first pages" in the blank headers.



Why all this? It seems that Word keeps the initial making of a file's H/F
in the last paragraph mark of the entire file. I'm not sure it ever
disappears despite make intervening section breaks. By having exactly two
lines in the header that are blank, one can code for their removal or
replacement. If you try to code deleting 3 header lines here, you might be
deleting a first line of footer information.



Cheers,

Gil

http://www.TenSecondMedicalRecord.com



-------------------

Sub Macro31()

'

' Macro31 Macro

' Macro recorded 1/26/2007 by Gil Carter

'



Application.DisplayAutoCompleteTips = True

NormalTemplate.AutoTextEntries("sectHF5").Insert Whe=Selection.Range,
_

RichText:=True

Selection.MoveUp Unit:=wdLine, Count:=3

If ActiveWindow.View.SplitSpecial wdPaneNone Then

ActiveWindow.Panes(2).Close

End If

If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _

ActivePane.View.Type = wdOutlineView Then

ActiveWindow.ActivePane.View.Type = wdPrintView

End If

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

Selection.TypeText Text:=" "

Application.Run MacroName:="Project.NewMacros.makeNormalFont"

Selection.MoveLeft Unit:=wdCharacter, Count:=1

Application.Run MacroName:="Project.makelinemedium.MAIN"

Selection.TypeBackspace

Selection.TypeBackspace

Selection.TypeBackspace

Selection.TypeText Text:=ptNamx & ", dob " & ptDob & ", date "

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_

"DATE \@ ""MMMM d, yyyy"" ", PreserveFormatting:=True

Selection.TypeText Text:=" "

Selection.MoveRight Unit:=wdCharacter, Count:=1

Selection.TypeText Text:="by "

Application.Run MacroName:="Project.NewMacros.makeNormalFont"

Application.Run MacroName:="Project.makelinemedium.MAIN"

Selection.TypeBackspace

Selection.TypeBackspace

Application.DisplayAutoCompleteTips = True

Templates.Application.NormalTemplate.AutoTextEntri es("myName").Insert
_

Whe=Selection.Range, RichText:=True

Selection.TypeText Text:=" "

ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

End Sub




-------------



"gil" wrote in message
...
What are the 10 most common problems in using headers and footers when
using different first pages? For 10 years I've recommended that users
avoid them unless they have to. I spent another several hours this
morning trying to learn how to get the section headers not to

insert section page break at bottom of file

insert hard Page so you can have a nonfirst page header

view header

break link

page setup different first page

go to footer and break link

go to page format, break link, select start at new page number 1

go back to header

make sure you're in current section NOT first page, break link if it
changed back on you

insert your non-first page header

move to first page header make sure it's empty

go to prior section, make sure it's not been linked to later section's
headers,

then do the same whole sequence for the footers

ABSOLUTELY ESSENTIAL TO BREAK THE LINK EACH TIME YOU ENTER A HEADER OR
FOOTER BOX BEFORE ANY TEXT ENTRY. Any text entry seems to replace the
prior sections headers instantly.

YOU CANNOT PLACE A HEADER FOR NON-FIRST PAGE HEADERS UNTIL AFTER YOU MAKE
A SECOND PAGE.



TIA

Long time sufferer