I'm trying to create a fairly simple memo template. when the memo
becomes longer than one page, I'd like to be able to create the footer
for page two and beyond (which happens to include a logo that's not in
the first page footer). Is there such an event I can trap?
I do realize I may be approaching this the wrong way. I can see how to
set the page layout to "different first page," but is it possible to
create the second (and beyond) page footer without actually having more
than one page (eg when document is created but before it becomes more
than one page long)?
Jens, I had a similar need (actually a desire). My solution was a
macro (actually, 2 macros) shown below. Maybe you can modify it.
To use it, I open the footer and click on a button. The macro that
inserts the following into the footer, at the left margin:
{ FILENAME \* MERGEFORMAT }
This is a Word "Field" that displays the current filename.
The macro does some other calculations to determine the page width and
then set a Right tab at the right margin. It then puts this field at
the right margin:
{ if { numpages } > 1 "p. { page} " "" }
This combination of fields displays nothing if there is only 1 page in
the document. Otherwise, it displays the page number.
Good luck.
Steven
' ============================
Sub myFooter()
'
' myFooter Macro
' Macro recorded 7/8/2001
Dim myWidth As Single, myWidthInches As Single
With ActiveDocument.PageSetup
myWidthInches = .PageWidth - .RightMargin - .LeftMargin
myWidth = PointsToInches(myWidthInches)
End With
With Selection
.ParagraphFormat.TabStops.ClearAll
.ParagraphFormat.TabStops.Add Position:=InchesToPoints(myWidth), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
.MoveLeft Unit:=wdCharacter, Count:=1
.Fields.Add Range:=.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME ", PreserveFormatting:=True
.TypeText Text:=vbTab
varPages
End With
Selection.WholeStory
With Selection.Font
.Name = "Arial": .Size = 10: .Bold = False: .Italic = False
End With
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0): .RightIndent = _
InchesToPoints(0)
.SpaceBefore = 0: .SpaceBeforeAuto = False: .SpaceAfter = 0
End With
End Sub
Sub varPages()
'
' varPages Macro
' Macro recorded 3/14/2003 by Steven Marzuola
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="if "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="numpages"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" > 1 ""p. "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="page"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=""" """""
Selection.EndKey Unit:=wdLine
End Sub