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:
 

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

Similar Threads

Macro to fix header 0
Letterhead Macro 1
Page setup 14
macro problems 0
Word macro help- formatting and printing 2
Problem with Office 2003 vba in Office 2007 6
Run-time error '4608: Value out of range error 9
Script 2

Top