Detecting when document becomes longer than one page

J

JensST1100

I'm trying to create a fairly simple memo template. when the mem
becomes longer than one page, I'd like to be able to create the foote
for page two and beyond (which happens to include a logo that's not i
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 t
set the page layout to "different first page," but is it possible t
create the second (and beyond) page footer without actually having mor
than one page (eg when document is created but before it becomes mor
than one page long)?

Jen
 
C

Cindy M -WordMVP-

Hi JensST1100,
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)?
This is the way to go. There's no event that triggers when Word breaks to
a new page. And yes, you can insert a manual page break in the template,
create the second page headers/footers, then delete the page break. Word
will remember what you've entered, even though the information can't
currently be displayed.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
S

Steven M (remove wax to reply)

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
 

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