PDA

View Full Version : Help placing footer on 1st page only



newk
01-27-2006, 03:46 AM
Hi everyone,

I am currently using the following code:


Case Is = Me.optBrighton
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.MoveDown Unit:=wdLine, Count:=9
Selection.Range.Text = "Brighton BN1"
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
With Selection
.Font.Size = 8
.Paragraphs.Alignment = wdAlignParagraphLeft
End With
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeParagraph
Selection.Range.Text = "Tel: Fax: Email:"
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
With Selection
.Font.Size = 8
.Paragraphs.Alignment = wdAlignParagraphLeft
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument


This is part of an 'option box' selection code. When someone selects 'BRIGHTON' those 2 lines of text should write to the bottom of the first page. However the document is now 3 pages long and it always writes the two lines to the 3rd page.

I am sure the problem is

wdSeekCurrentPageFooter


I guess it needs to be

wdSeekFirstPageFooter

Please can someone help

TonyJollans
01-27-2006, 05:44 AM
If you're sure of the problem, and you have an idea of the solution - have you tried it?

I know all the 'Seek' stuff is generated by the Macro Recorder but you neither need nor want it in VBA. You can work directly with the Ranges of the Header and Footer content, for exampleSet myRange = ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range etc.