S
Scott A
I have a macro that changes the paper size from A4 to
Letter, and updates the TOC. I also have another that
does the reverse.
It works fine, until I insert a Landscape section into the
document, when it indicates that a value is out of range
(highlighting .LineNumbering.Active = False)
Here's the first part of the macro that switches the page
layout:
==========================================================
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(2.5)
.BottomMargin = CentimetersToPoints(2.5)
.LeftMargin = CentimetersToPoints(2.5)
.RightMargin = CentimetersToPoints(2.5)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.5)
.FooterDistance = CentimetersToPoints(1)
.PageWidth = CentimetersToPoints(21.59)
.PageHeight = CentimetersToPoints(27.94)
.FirstPageTray = wdPrinterFormSource
.OtherPagesTray = wdPrinterFormSource
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterPos = wdGutterPosLeft
End With
========================================================
Is there a better way to do this that will work with both
landscape and portrait sections in the document?
Thanks,
Scott A
Letter, and updates the TOC. I also have another that
does the reverse.
It works fine, until I insert a Landscape section into the
document, when it indicates that a value is out of range
(highlighting .LineNumbering.Active = False)
Here's the first part of the macro that switches the page
layout:
==========================================================
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(2.5)
.BottomMargin = CentimetersToPoints(2.5)
.LeftMargin = CentimetersToPoints(2.5)
.RightMargin = CentimetersToPoints(2.5)
.Gutter = CentimetersToPoints(0)
.HeaderDistance = CentimetersToPoints(1.5)
.FooterDistance = CentimetersToPoints(1)
.PageWidth = CentimetersToPoints(21.59)
.PageHeight = CentimetersToPoints(27.94)
.FirstPageTray = wdPrinterFormSource
.OtherPagesTray = wdPrinterFormSource
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.GutterPos = wdGutterPosLeft
End With
========================================================
Is there a better way to do this that will work with both
landscape and portrait sections in the document?
Thanks,
Scott A