How to insert text in footer only on last page.

D

Denise

Hello

Using Word XP SP-2 on Windows 2000 V5 SP-3.

I have created a template which takes the form of a newsletter, with 2
columns to a page. A disclaimer needs to appear at the end of the
newsletter. At present the disclaimer is held in a textbox which is
'shunted along' as more text is typed. However, this textbox is prone to
bad behaviour (despite being anchored it often disappears offscreen which
goes unnoticed until it's too late) and my user would like an alternative.

I had the idea of putting the text from the box into the footer, but the
catch is I only want it to appear on the last page. I've tried inserting a
continuous section break at the bottom of the page so that the footer will
be in a different section but this has given undesirable results.

Does anyone know how to go about this successfully, or can anyone suggest an
alternative. There is quite a lot of text to be entered and it contains a
field which needs to be updated (so a graphic is out of the question). I
did something similar a while ago using VBA code to enter a field with 'IF
PAGE = NUMPAGES', but I don't think I can use that on this occasion as I
can't think of a way to trigger the code.

I hope this all makes sense! And that someone will be able to help.

Many thanks

Denise Crawley
 
D

Denise

Thanks for this, Graham. Unfortunately I'm not able to get it to work. If
I insert {AUTOTEXT Disclaimer} as a field it works fine. But if I try to
expand on it with {IF {PAGE} = {NUMPAGES} "{AUTOTEXT Disclaimer}"} nothing
shows up, even when I create a brand new field with this text.

Is there anything obviously wrong with what I'm doing?

Thanks again

Denise
 
D

Denise

Thanks Graham. I was remembering all those things. I think it's just a wee
bit temperamental. The document only has 2 sections so hopefully this won't
present a problem.

Can I ask your advice on achieving this via VBA code? I've used a version
of the following in the past, quite successfully, but am having trouble
modifying it to accommodate the Autotext field:-

<< Start of code >>
Public Sub CIFooter()

ActiveWindow.ActivePane.View.SeekView = wdSeekPrimaryFooter

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:="PAGE"
Selection.MoveRight unit:=wdCharacter, Count:=2
Selection.TypeText Text:="="
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
preserveformatting:=False
Selection.TypeText Text:="NUMPAGES"
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
preserveformatting:=False
Selection.TypeText Text:="AUTOTEXT Disclaimer"

Selection.Collapse wdCollapseEnd
ActiveWindow.View.ShowFieldCodes = False
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
ActiveDocument.PrintPreview
ActiveDocument.ClosePrintPreview

End Sub
<< End of code >>

Would you be able to give me any tips?

Many thanks for your help with this!

Denise
 
J

Jay Freedman

Hi, Denise,

The code you posted puts the { AUTOTEXT "Disclaimer" } field *inside* the
{ NUMPAGES } field. You need another Selection.MoveRight statement to put
the cursor between the closing brace of the AUTOTEXT and the closing brace
of the IF field. You can see this if you single-step the macro with F8.

But *why* are you trying to do this in code?? Just put the complete field in
the footer of the template and save it -- then you don't need the macro at
all.
 
D

Denise

Hi Jay

Thanks for this, I've got it sorted now.

The reason I wanted to do it with code is that there are other fields in the
footer for that section which I don't want to lose on the other pages. I
figured that adding the disclaimer should be the last thing that is done so
wanted the code to be triggered when the document was ready to go. I'm not
sure if that makes any sense, but that's what was in my head!

Thanks again

Denise
 

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