Footer Page Numbers

K

Kerry

I have macros to insert an A4 Landscape Page, A3 Portrait
and an A3 Landscape page.

When these pages are inserted it obviously has to insert
a section break. The insertion works wonderfully,
however the page numbering in my footer restarts at 1 on
all new pages. If I maually edit the footer and change
the format to continue from pervious it updates and all
is well but I would like to make this happen
automatically as part of the insert page procedure.

I cannot find reference anywhere to the command
of "continue from previous" - can anyone help?? Is it
possible to change the number format of a page number in
code??

Thanks

Kerry
 
H

Harold

You can use this
Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = False
 
K

Kerry

Hi Harold

Many thanks for the tip. I have entered the extra
command line in to my procedure but keep getting the
followiing error

Run time error 91 - object variable or with block
variable not set

please see my code below - have I just put the command in
the wrong place?? many thanks.
----------
Sub InsLscPgA3()
'Insert a Landscape Page
'On Error GoTo EndLine
Selection.InsertBreak Type:=wdSectionBreakNextPage

With Selection.PageSetup
.PaperSize = wdPaperA3
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(1.25)
.BottomMargin = InchesToPoints(1.25)
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(2.5)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.49)
.FooterDistance = InchesToPoints(0.49)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.HeaderFooter.PageNumbers.RestartNumberingAtSecti
on = False
Exit Sub
EndLine:
MsgBox "Your printer will not allow A3 pages - change
your default print settings"
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