Page formatting macro

N

NJ

I have a macro that formats a document to a custom layout
or paper size. The macro seems to work ok when previewed
but when the document is printed the users get the "Page
is outside of margins..." message. They have to remember
to go into page properties and select "Apply to Whole
Document" if they fail to do this then the printer asks
for paper to be fed manually... They do a lot of printing
so this is a pain for them

Is there any way in the macro to have the "printer"
format apply to whole document?

This is the macro:
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
.LineNumbering.Active = False
'.Orientation = wdOrientLandscape
'.Orientation = 1
.TopMargin = InchesToPoints(0.17)
.BottomMargin = InchesToPoints(0.17)
.LeftMargin = InchesToPoints(0.42)
.RightMargin = InchesToPoints(0.53)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(8)
.PageHeight = InchesToPoints(3.3)
.FirstPageTray = wdPrinterUpperBin
.OtherPagesTray = wdPrinterUpperBin
.SectionStart = wdSectionContinuous
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = True
.MirrorMargins = False
.TwoPagesOnOne = False
'.BookFoldPrinting = False
'.BookFoldRevPrinting = False
'.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
 
W

Word Heretic

G'day "NJ" <[email protected]>,

Dim aSection as Section
for each aSection in ActiveDocument.Sections

(adapt your macro to run use the aSection.PageSetup)

next
Set aSection=Nothing


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


NJ reckoned:
 
Top